blob: 65be1f452add49f26abd9ea3c5a9c27e304c3697 [file] [log] [blame]
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>2.&nbsp; OpenJPA Logging</title><link rel="stylesheet" href="css/docbook.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.72.0"><link rel="start" href="manual.html" title="Apache OpenJPA User's Guide"><link rel="up" href="ref_guide_logging.html" title="Chapter&nbsp;3.&nbsp; Logging"><link rel="prev" href="ref_guide_logging.html" title="Chapter&nbsp;3.&nbsp; Logging"><link rel="next" href="ref_guide_logging_noop.html" title="3.&nbsp; Disabling Logging"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">2.&nbsp;
OpenJPA Logging
</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ref_guide_logging.html">Prev</a>&nbsp;</td><th width="60%" align="center">Chapter&nbsp;3.&nbsp;
Logging
</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="ref_guide_logging_noop.html">Next</a></td></tr></table><hr></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="ref_guide_logging_openjpa"></a>2.&nbsp;
OpenJPA Logging
</h2></div></div></div><a class="indexterm" name="d0e16944"></a><p>
By default, OpenJPA uses a basic logging framework with the following output
format:
</p><p>
<code class="literal">millis</code>&nbsp;&nbsp;<code class="literal">diagnostic context</code>&nbsp;&nbsp;<code class="literal">level</code>&nbsp;&nbsp;[<code class="literal">thread name</code>]&nbsp;&nbsp;<code class="literal">channel</code> - <code class="literal">message</code>
</p><p>
For example, when loading an application that uses OpenJPA, a message like the
following will be sent to the <code class="literal">openjpa.Runtime</code> channel:
</p><pre class="programlisting">
2107 INFO [main] openjpa.Runtime - Starting OpenJPA 0.9.7
</pre><p>
The default logging system accepts the following parameters:
</p><div class="itemizedlist"><ul type="disc"><li><p>
<code class="literal">File</code>: The name of the file to log to, or <code class="literal">stdout
</code> or <code class="literal">stderr</code> to send messages to standard out and
standard error, respectively. By default, OpenJPA sends log messages to standard
error.
</p></li><li><p>
<code class="literal">DefaultLevel</code>: The default logging level of unconfigured
channels. Recognized values are <code class="literal"> TRACE, DEBUG, INFO, WARN,</code>
and <code class="literal">ERROR</code>. Defaults to <code class="literal">INFO</code>.
</p></li><li><p>
<code class="literal">DiagnosticContext</code>: A string that will be prepended to all
log messages. If this is not supplied and an <code class="literal">openjpa.Id</code>
property value is available, that value will be used.
</p></li><li><p>
<code class="literal">&lt;channel&gt;</code>: Using the last token of the
<a href="ref_guide_logging.html#ref_guide_logging_channels" title="1.&nbsp; Logging Channels">logging channel</a> name, you can
configure the log level to use for that channel. See the examples below.
</p></li></ul></div><div class="example"><a name="ref_guide_logging_openjpa_std_ex"></a><p class="title"><b>Example&nbsp;3.1.&nbsp;
Standard OpenJPA Log Configuration
</b></p><div class="example-contents"><pre class="programlisting">
&lt;property name="openjpa.Log" value="DefaultLevel=WARN, Runtime=INFO, Tool=INFO"/&gt;
</pre></div></div><br class="example-break"><div class="example"><a name="ref_guide_logging_openjpa_sql_ex"></a><p class="title"><b>Example&nbsp;3.2.&nbsp;
Standard OpenJPA Log Configuration + All SQL Statements
</b></p><div class="example-contents"><pre class="programlisting">
&lt;property name="openjpa.Log" value="DefaultLevel=WARN, Runtime=INFO, Tool=INFO, SQL=TRACE"/&gt;
</pre></div></div><br class="example-break"><div class="example"><a name="ref_guide_logging_openjpa_file"></a><p class="title"><b>Example&nbsp;3.3.&nbsp;
Logging to a File
</b></p><div class="example-contents"><pre class="programlisting">
&lt;property name="openjpa.Log" value="File=/tmp/org.apache.openjpa.log, DefaultLevel=WARN, Runtime=INFO, Tool=INFO"/&gt;
</pre></div></div><br class="example-break"></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ref_guide_logging.html">Prev</a>&nbsp;</td><td width="20%" align="center"><a accesskey="u" href="ref_guide_logging.html">Up</a></td><td width="40%" align="right">&nbsp;<a accesskey="n" href="ref_guide_logging_noop.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter&nbsp;3.&nbsp;
Logging
&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="manual.html">Home</a></td><td width="40%" align="right" valign="top">&nbsp;3.&nbsp;
Disabling Logging
</td></tr></table></div></body></html>