Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The logging framework used in the DuraCloud application is SLF4J with the LogBack implementation statically bound at runtime.
See the LogBack website for a detailed description of the configuration options.

...

  • By default, if no configuration file is found by LogBack, the logging level is set to "DEBUG" and the appender is set to "STDOUT"
  • When starting any DuraCloud application, a LogBack configuration file may be specified by using the following system variable

    No Format
    
    java -Dlogback.configurationFile={path-to-logging-configuration-file} -jar any-application
    
  • Additionally, LogBack will use the file named "logback.xml" found at the top of the classpath for configuration
  • An example logback.xml file can be found

    on the Downloads page

    on here.

    No Format
    
    1<?xml version="1.0" encoding="UTF-8"?>
    2
    3<configuration >
    4  <!--<configuration debug="true" scan="true">-->
    5  <jmxConfigurator/>
    6  <property name="LOG_FILENAME" value="/home/duraspace/logs/duracloud-osgi.log" />
    7
    8  <appender name="DURACLOUD" class="ch.qos.logback.core.rolling.RollingFileAppender">
    9    <File>${LOG_FILENAME}</File>
    10    <encoder>
    11      <pattern>%-14p %d{yyyy/MM/dd HH:mm:ss} [%t] (%F:%L\\) [%M(\\)] - %m%n</pattern>
    12    </encoder>
    13    <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
    14      <maxIndex>5</maxIndex>
    15      <FileNamePattern>${LOG_FILENAME}.%i</FileNamePattern>
    16    </rollingPolicy>
    17    <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
    18      <MaxFileSize>20MB</MaxFileSize>
    19    </triggeringPolicy>
    20  </appender>
    21  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
    22    <encoder>
    23      <pattern>%-14p %d{yyyy/MM/dd HH:mm:ss} [%t] (%F:%L\\) [%M(\\)] - %m%n</pattern>
    24    </encoder>
    25  </appender>
    26  <logger name="org.duracloud" level="DEBUG" additivity="false">
    27    <appender-ref ref="DURACLOUD"/>
    28  </logger>
    29   <root level="WARN">
    30    <appender-ref ref="STDOUT"/>
    31  </root>
    32</configuration>
    
  • Notes on the above logback.xml file
    • on line 4, the attribute "debug" applies to displaying configuration information when LogBack starts up if set to "true"
    • on line 4, the attribute "scan" configures LogBack to re-read the given logback.xml every 60 seconds (by default) for updates
    • on line 26, the attribute "additivity" configures the given logger to inherit the configuration of the parent logger, in this case, the root logger
    • on line 26, if the "additivity" attribute were set to "true", all "DURACLOUD" log output would also log to "STDOUT"