5.2 Trace

The SpringSource dm Server's trace support serve two main purposes:

Entries in trace files are of the form <timestamp> <thread-name> <source> <level> <entry-text>. For example:

[2008-05-15 09:09:46.940] server-dm-2 org.apache.coyote.http11.Http11Protocol I Initializing Coyote HTTP/1.1 on http-48080
	    

By default, trace files are stored in $SERVER_HOME/serviceability/trace.

5.2.1 Application Output

SpringSource dm Server provides advanced support for capturing and tracing application-generated output. It automatically partitions trace on a per-application basis and will also capture any System.out and System.err output and direct it to the generating application's trace.log file.

5.2.1.1 Per-application trace

SpringSource dm Server uses SLF4J-based implementations of both Commons Logging and Log4J to route output generated by applications using those APIs to its trace files. In addition to appending such output to the global trace.log it will also append it to an application-specific trace file.

SpringSource dm Server writes application-specific trace to a file in a subdirectory of the configured trace directory. As described above this directory is, by default, SERVER_HOME/serviceability/trace. The subdirectory's name is of the form <application-name>-<version>. So, for example, an application named com.myapp at version 1 will write its trace to a file in SERVER_HOME/serviceability/trace/com.myapp-1/.

The levels used to filter per-application trace can be configured by using a header in the application's manifest specifying a comma-separated list of package and class names. For example:

Application-TraceLevels: *=info,com.myapp.*=verbose
                

This example manifest header will enable info level tracing for everything other than classes in the com.myapp package for which verbose level tracing will be enabled.

5.2.1.2 System.out and System.err

SpringSource dm Server captures, and traces, all output generated via System.out and System.err. This means that such output will be written to both the global trace.log file and to the trace file specific to the application that generated the output. The trace entries for System.out and System.err output are of the form:

[2008-05-16 09:28:45.874] server-tomcat-thread-1 System.out I Hello world!
[2008-05-16 09:28:45.874] server-tomcat-thread-1 System.err E Hello world!
			

As you can see the third column indicates where the output came from, i.e. System.out or System.err and, as indicated by the fourth column, System.out is traced at the Info level, and System.err is traced at the error level.

5.2.2 Roll-over of trace files

SpringSource dm Server will automatically roll-over a trace file once it reaches a size of 100MB. Up to four rolled-over files will be retained in addition to the trace.log file to which new output is appended.