Skip to main content

Logging configuration

Logging layout patterns

The pattern of each individual line logged by log4j can be customized in the layout element of an appender. See the following example:

Log Layout Appender Example
<appender name="SERVER" class="org.apache.log4j.RollingFileAppender">
<errorHandler class="org.apache.log4j.helpers.OnlyOnceErrorHandler"/>
<param name="File" value="log/nevislogrend.log"/>
<param name="Append" value="true"/>
<param name="MaxFileSize" value="10MB"/>
<param name="MaxBackupIndex" value="9"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{ISO8601} %-15.15t %-40.40c %-5.5p %X{indent}%m%n"/>
</layout>
</appender>

The above example will prefix log lines with the following, and in that order:

  • a date/time timestamp (%d),
  • the thread name (%t),
  • the conversation ID (%X{conversationId}),
  • the trace group (%c)
  • the priority of the trace message (%p).

It will also indent traces (%X{indent}).

Important trace groups

The following list shows the most important general trace groups, in combination with relevant debugging use cases:

  • Full trace analysis (debugging in test environment only)

    <root>
    <priority value="DEBUG"/>
    <appender-ref ref="SERVER"/>
    </root>
  • General debugging

    <category name="ch.nevis.logrend">
    <priority value="INFO"/>
    </category>
  • General debugging translation / GuiDescriptor problems

    <category name="ch.nevis.logrend.beans.LoginBean">
    <priority value="DEBUG"/>
    </category>
  • Low level debugging

    <category name="org.eclipse.jetty">
    <priority value="DEBUG"/>
    </category>
info

For all logging groups and their description, see the log4j configuration of your instance. If you need more examples, check the default configuration template here: /opt/nevislogrend/template/conf/log4j.xml