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.
The application also contains bridges for both Log4J and Commons-Logging which translates any underlying, dependency libraries which are configured to write to these frameworks into the SLF4J API. The effect is that all logging is channeled through the SLF4J configuration.
When starting any DuraCloud application, a LogBack configuration file may be specified by using the following system variable
java -Dlogback.configurationFile={path-to-logging-configuration-file} -jar any-application |
An example logback.xml file can be found on here.
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> |