Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

To get more debugging information (e.g., to see the SQL that is being executed against the database), you can enable trace-level logging from the command line using the "openjpa.loglevelLog" system property. For example:

Code Block
$ mvn test -Dtest=TestPersistence -Dopenjpa.loglevelLog=DefaultLevel=TRACE

[INFO] Scanning for projects...
[INFO] Reactor build order: 
...
690  test  TRACE  [main] openjpa.jdbc.SQL - <t 4261185, conn 3061987> executing prepstmnt 12659709 
   INSERT INTO AllFieldTypes (id, arrayOfStrings, booleanField, byteField, charField, dateField, 
   doubleField, floatField, intField, longField, shortField, stringField) 
   VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) [params=(long) 601, (null) null, (int) 0, (byte) 0, 
   (int) 0, (null) null, (double) 0.0, (float) 0.0, (int) 0, (long) 0, (short) 0, (null) null]
701  test  TRACE  [main] openjpa.jdbc.SQL - <t 4261185, conn 3061987> [11 ms] spent
701  test  TRACE  [main] openjpa.jdbc.JDBC - <t 4261185, conn 3061987> [0 ms] commit
702  test  TRACE  [main] openjpa.jdbc.JDBC - <t 4261185, conn 0> [0 ms] close
...
$

Setting additional Log parameters

There are several parameters that are used by OpenJPA Log. Here are some that might be of value when debugging test cases:

  • DefaultLevel sets the level for all loggers that are not otherwise set
  • file sets the file name for logging output
  • Enhance logs messages from the enhancer
  • Metadata logs messages from the metadata processor
  • Tool logs messages from the schema synchronization tool
  • SQL logs messages from the SQL generator
  • JDBC logs messages related to JDBC
  • Schema logs messages related to schema
  • Runtime logs messages related to runtime
  • Query logs messages related to queried
  • DataCache logs messages related to caching

Log levels are:

  • INFO
  • TRACE
  • WARN
  • ERROR
  • SEVERE

Testing against alternate databases

...