OpenJPA
  1. OpenJPA
  2. OPENJPA-577

OpenJPA doesn't create LoggingConnectionDecorator instance if log trace is not enabled

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.1.0
    • Fix Version/s: 1.1.0
    • Component/s: jdbc
    • Labels:
      None

      Description

      In current openjpa code, a LoggingConnectionDecorator instance is created only if jdbcLog or sqlLog trace is enabled. This change was made for resolving issue http://issues.apache.org/jira/browse/OPENJPA-407.

      $ svn diff -r 589723:590150 DataSourceFactory.java

      Index: DataSourceFactory.java
      ===================================================================
      — DataSourceFactory.java (revision 589723)
      +++ DataSourceFactory.java (revision 590150)
      @@ -162,12 +162,15 @@
      decorators.addAll(decs);
      }

      • // logging decorator
      • LoggingConnectionDecorator lcd = new LoggingConnectionDecorator();
      • Configurations.configureInstance(lcd, conf, opts);
      • lcd.getLogs().setJDBCLog(jdbcLog);
      • lcd.getLogs().setSQLLog(sqlLog);
      • decorators.add(lcd);
        + if (jdbcLog.isTraceEnabled() || sqlLog.isTraceEnabled()) { + // logging decorator + LoggingConnectionDecorator lcd = + new LoggingConnectionDecorator(); + Configurations.configureInstance(lcd, conf, opts); + lcd.getLogs().setJDBCLog(jdbcLog); + lcd.getLogs().setSQLLog(sqlLog); + decorators.add(lcd); + }

      dds.addDecorators(decorators);
      return dds;

      With this change, openjpa.ConnectionFactoryProperties options ("PrettyPrint", "PrettyPrintLineLength") and kodo.ConnectionFactoryProperties("TrackParameters") won't take effect unless log trace is enabled.

      Before this change we allow tracking parameters in error reporting when logging is disabled. I believe this is a regresson, and we should revert that change.

        Activity

        Jason Zheng created issue -
        Hide
        Jason Zheng added a comment -

        The attached patch reverted the change made in r590150 for DataSourceFactory.java, so openjpa will create an instance of LoggingConnectionDecorator even if the log trace is disabled.

        Show
        Jason Zheng added a comment - The attached patch reverted the change made in r590150 for DataSourceFactory.java, so openjpa will create an instance of LoggingConnectionDecorator even if the log trace is disabled.
        Jason Zheng made changes -
        Field Original Value New Value
        Attachment OPENJPA-577.patch [ 12380625 ]
        Patrick Linskey made changes -
        Resolution Fixed [ 1 ]
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 1.1.0 [ 12312344 ]
        Hide
        Patrick Linskey added a comment -

        Keeping open as a reminder to backport to trunk.

        Show
        Patrick Linskey added a comment - Keeping open as a reminder to backport to trunk.
        Patrick Linskey made changes -
        Status Resolved [ 5 ] Reopened [ 4 ]
        Resolution Fixed [ 1 ]
        Patrick Linskey made changes -
        Status Reopened [ 4 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Donald Woods made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Jason Zheng
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development