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.

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.

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/.

You configure the levels used to filter per-application trace by specifying a header in the application's MANIFEST.MF file that includes a comma-separated list of package and class names. For example:

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

This sample MANIFEST.MF header enables info level tracing for everything except the classes in the com.myapp package for which verbose level tracing is enabled.

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!
			

The third column indicates where the output came from (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.

Roll-over of trace files

SpringSource dm Server automatically rolls-over a trace file once it reaches a size of 100MB. SpringSource dm Server retains up to four rolled-over files in addition to the trace.log file to which new output is appended.