CoreContentOnly

Content Server Tracing and Creating Your Own Custom Trace

Jul 20, 2008

Using “View Server Output” from the admin server can tell you a lot about what is going on inside your content server. The server output can accumulate so much information it can easily be overwhelming. To help with this we are going to take a closer look at the tracing sections and how we can expand the built in list of sections to allow us to trace and troubleshoot the code we build for content server. The information detailed in server output depends on your configuration setup in the System Audit page:

The comma separated list of active tracing sections can be saved into config.cfg under TraceSectionsList. The checkbox next to Full Verbose Tracing would represent TraceIsVerbose in the config.cfg file. Descriptions of these can be found in the IDOC Script Reference Guide. Recall your config.cfg file is in the /config directory, not in the bin directory. The drop down list is filled with sections you can use to narrow or expand your tracing output with.

The server output does not show all activity from all of history. It only displays the most recent activity, and if you are planning on dumping out the full contents of a DataBinder you probably will miss some of the data. On windows, it comes in handy during a full-on-debug-session to add UseRedirectedOutput to your config.cfg file. This will dump the log out to a file on disk. Do not forget to turn this off later or you may run out of disk space or enjoy some decreasing performance metrics.

Excellent, with this basic information under our belt we can now look at how you might add a trace section to that drop down. Say for example you have some code you would like to instrument with tracing so you can see it in server output. Just how might you add your custom-section to the drop down list?

So, having replaced the defaulted information with my specific information I end up with the adjusted resource file looking something like this:

<tr>
<td>TraceSample</td>
<td>Example of custom section tracing</td>
<td>false</td>
</tr>

Having used component manager or component wizard to ENABLE my component (you enabled yours right?) and restarted my content server (you restarted yours right?) I can now see my new custom tracing section in the drop down list in the System Audit page:

Whew. If you have made it this far please stick around a little longer, we are finally ready for the big payoff. We understand tracing now, we understand how to add sections to be traced. So, please, please just tell us how to instrument the code to take advantage of this already! To make use of this in IdocScript use the trace function like this:

IdocScript Tracing

<$trace("message", "#console", "CustomTraceSectionName")$>

So, for the example section I created I would write something like:

<$trace("Trace Test!", "#console", "TraceSample")$>

One word of caution, sometimes when you copy code like this off the web the quotes get out of whack (technical term!). So if you have problems, when you paste this in try retyping the quotes. Or, once installed you could use the test template included in the example component to see how things work.

Java Tracing

If you wanted to use this in Java code you can use SystemUtils.trace(“CustomTraceSectionName”, “Your Message”); to instrument your Java code for tracing. Inside your Java code you can also take advantage of the “Full Verbose Tracing” checkbox setting by testing the value of SystemUtils.m_verbose, like this:

if (SystemUtils.m_verbose) { SystemUtils.trace("TraceSample" , "Tracing from my java code against my custom trace section"); }

You can also dump information about an exception with some code like this:

SystemUtils.traceDumpException("filestore" , "Error encountered saving file to file store.", e);

20100127_build1_tracingsample.zip

© 2019 Jason Stortz