3.4.2. OpenJPA Logging
By default, OpenJPA uses a basic logging framework with the following output format:
millisdiagnostic contextlevelchannel - message
For example, when loading an application that uses OpenJPA, a message like the following will be sent to the openjpa.Runtime channel:
2107 INFO [main] openjpa.Runtime - Starting OpenJPA 2.2.0
The default logging system accepts the following parameters:
-
File: The name of the file to log to, orstdoutorstderrto send messages to standard out and standard error, respectively. By default, OpenJPA sends log messages to standard error. -
DefaultLevel: The default logging level of unconfigured channels. Recognized values areTRACE, INFO, WARN, ERRORandFATAL. Defaults toINFO. -
DiagnosticContext: A string that will be prepended to all log messages. If this is not supplied and anopenjpa.Idproperty value is available, that value will be used. -
channel: Using the last token of the logging channel name, you can configure the log level to use for that channel. See the examples below.
<property name="openjpa.Log" value="DefaultLevel=WARN, Runtime=INFO, Tool=INFO"/>
<property name="openjpa.Log" value="DefaultLevel=WARN, Runtime=INFO, Tool=INFO, SQL=TRACE"/>
<property name="openjpa.Log" value="File=/tmp/org.apache.openjpa.log, DefaultLevel=WARN, Runtime=INFO, Tool=INFO"/>