Setting SLF4J using logback configuration properties

To enable execution tracing, the following SLF4J using logback configuration properties are required:

  • 
      <logger name="com.workbrain2.compliance.svc.ComplianceValidationService" level="DEBUG">
        <appender-ref ref="compliance"/>
      </logger>

    To configure compliance logging for diagnostics, it is recommended that you create a configuration with a granularity as specific as com.workbrain2.compliance.svc.ComplianceValidationService. This will provide the most consistent and readable logging output.

    Compliance diagnostics are logged at the DEBUG level, so you must configure the compliance logging level at DEBUG (or lower). For example, if it is configured at ERROR only, none of the diagnostic information will be written to the log file/output. But if it is configured at ALL, everything (including the diagnostic information) will be written to the log file/output.

  • 
      <logger name="com.workbrain2.compliance.svc.ComplianceValidationService" level="DEBUG" additivity="false">
        <appender-ref ref="compliance"/>
      </logger>

    Prevents the DEBUG trace output from adding/propagating to the console and other log files. If this behavior is desired (you need to show the same trace output to console and parent log files), you can set the additivity flag to true.

To enable execution tracing, the following logback.xml configuration properties are recommended and can be customized accordingly:


 <appender name="compliance" class="ch.qos.logback.core.rolling.RollingFileAppender">
    <File>compliance.log</File>
    <encoder>
      <pattern>[%d{yyyy-MM-dd HH:mm:ss}] %m%n</pattern>
    </encoder>
    <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
      <maxIndex>1</maxIndex>
      <FileNamePattern>compliance.log.%i</FileNamePattern>
    </rollingPolicy>
    <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
      <MaxFileSize>2000KB</MaxFileSize>
    </triggeringPolicy>
  </appender>

You can set these properties using the local application server's logback.xml file. (The specific location of the logging configuration can vary from server to server. For more details, contact your server administrator.)