blob: 4362511eba9098737291685d014b1e68010542c1 [file] [log] [blame]
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>9.2&nbsp;(Trace) Logging</title><link rel="stylesheet" href="css/stylesheet.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.74.0"><link rel="home" href="index.html" title="Virgo User Guide"><link rel="up" href="ch09.html" title="9.&nbsp;Serviceability and Diagnostics"><link rel="prev" href="ch09.html" title="9.&nbsp;Serviceability and Diagnostics"><link rel="next" href="ch09s03.html" title="9.3&nbsp;Service Dumps"><!--Begin Google Analytics code--><script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script><script type="text/javascript">
var pageTracker = _gat._getTracker("UA-2728886-3");
pageTracker._setDomainName("none");
pageTracker._setAllowLinker(true);
pageTracker._trackPageview();
</script><!--End Google Analytics code--></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">9.2&nbsp;(Trace) Logging</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch09.html">Prev</a>&nbsp;</td><th width="60%" align="center">9.&nbsp;Serviceability and Diagnostics</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="ch09s03.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="serviceability-info-trace"></a>9.2&nbsp;(Trace) Logging</h2></div></div></div><p>
The Virgo&#8217;s (trace) logging support serves two main purposes:
</p><div class="itemizedlist"><ul type="disc"><li>
It provides global trace files that capture high-volume information regarding the Virgo&#8217;s internal events.
The files are intended for use by support personnel to diagnose runtime problems.
</li><li>
It provides application trace files that contain application-generated output. This includes output generated using popular logging and
tracing APIs including the OSGi LogService, as well as output generated by calls to <code class="literal">System.out</code> and <code class="literal">System.err</code>.
These files are intended for use by application developers and system administrators. An application is defined as a scope so a single bundle will
not get it's own log file unless it is a Web application Bundle or is included in a scoped plan or a par file.
</li></ul></div><p>
</p><p>
By default, the Virgo trace file is called <code class="literal">$SERVER_HOME/serviceability/logs/log.log</code>,
and, again by default, the application trace files are called <code class="literal">$SERVER_HOME/serviceability/logs/</code><span class="emphasis"><em>application_name</em></span>
<code class="literal">/log.log</code>, where <span class="emphasis"><em>application_name</em></span> is automatically set by Virgo for each application artifact
installed and run (it is a combination of the artifact name and the version).
</p><p>
The default behaviour of these trace files is that, once <code class="literal">log.log</code> reaches a 10Mb limit, it rolls into a series of files named
<code class="literal">log_</code><span class="emphasis"><em>i</em></span><code class="literal">.log</code> where <span class="emphasis"><em>i</em></span> ranges from 1 to 4, and logging continues in
a new <code class="literal">log.log</code> file.
</p><p>
Entries in trace files are by default of the form &lt;timestamp&gt; &lt;thread-name&gt; &lt;source&gt; &lt;level&gt; &lt;entry-text&gt;. For example:
</p><pre class="screen">
[2008-05-15 09:09:46.940] server-dm-2 org.apache.coyote.http11.Http11Protocol I Initializing Coyote HTTP/1.1 on http-48080
</pre><p>
although this format is completely determined by the Logback configuration file <code class="literal">serviceability.xml</code>.
</p><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="serviceability-info-trace-app"></a>Application Output</h3></div></div></div><p>
Virgo provides advanced support for capturing and tracing application-generated output by automatically separating trace output on a
per-application basis and will also capture any <code class="literal">System.out</code> and <code class="literal">System.err</code> output.
</p><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="per-application-trace"></a>Per-application trace</h4></div></div></div><p>
Virgo uses SLF4J interfaces to Logback, and the root logger (by default) captures all logging output
and appends it to the application-specific trace files as described above.
To modify this, define application-specific loggers in the <code class="literal">serviceability.xml</code> file in the normal way.
</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="sysout-and-syserr"></a>System.out and System.err</h4></div></div></div><p>
<code class="literal">System.out</code> and <code class="literal">System.err</code> output from applications is, by default, captured in the
application&#8217;s trace file.
This happens because the output streams are intercepted and written to the loggers named
<code class="literal">System.out</code> and <code class="literal">System.err</code> respectively.
Since there are no explicit loggers defined with these names in the <code class="literal">serviceability.xml</code> file,
this output is logged by the root logger (which captures <code class="literal">INFO</code> level and above).
</p><p>
The capture of <code class="literal">System.out</code> and <code class="literal">System.err</code> output is configured in the
<code class="literal">config/org.eclipse.virgo.medic.properties</code> file by the <code class="literal">log.wrapSysOut</code> and
<code class="literal">log.wrapSysErr</code> properties. By default the properties have a value of <code class="literal">true</code>
and capture is enabled. Capture can be disabled by configuring the properties with a value of <code class="literal">false</code>.
</p><p>
The trace entries for <code class="literal">System.out</code> and <code class="literal">System.err</code>
output are of the form:
</p><pre class="screen">
[2008-05-16 09:28:45.874] server-tomcat-thread-1 System.out Hello world!
[2008-05-16 09:28:45.874] server-tomcat-thread-1 System.err Hello world!
</pre><p>
The third column indicates where the output came from (<code class="literal">System.out</code> or <code class="literal">System.err</code>).
</p><p>
To over-ride this behaviour, simply define explicit loggers named <code class="literal">System.out</code>
and/or <code class="literal">System.err</code> in the configuration file to send this output to an appender of your choice.
Be aware that all applications&#8217; output streams will be caught by these loggers, and that a sifting appender might be useful to separate them.
</p></div></div></div><!--Begin LoopFuse code--><script src="http://loopfuse.net/webrecorder/js/listen.js" type="text/javascript"></script><script type="text/javascript">
_lf_cid = "LF_48be82fa";
_lf_remora();
</script><!--End LoopFuse code--><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch09.html">Prev</a>&nbsp;</td><td width="20%" align="center"><a accesskey="u" href="ch09.html">Up</a></td><td width="40%" align="right">&nbsp;<a accesskey="n" href="ch09s03.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">9.&nbsp;Serviceability and Diagnostics&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">&nbsp;9.3&nbsp;Service Dumps</td></tr></table></div></body></html>