Configuring logging for a Content Delivery software component
You already set up logging when you installed your Content Delivery software components. But you can configure logging in more detail by editing the logback.xml, the configuration file for the Logback logging framework used by Content Delivery.
About this task
For detailed information about the Logback framework and its configuration, refer to http://logback.qos.ch/documentation.html.
Procedure
- In the location of the software component for which you want to activate logging, open
logback.xmlfor editing. This file is located in the configuration location of your software component. - Set the following properties:
<property name="log.pattern" value="%date %-5level %logger{0} - %message%n"/> <property name="log.history" value="7"/> <property name="log.folder" value="./logs"/> <property name="log.level" value="ERROR"/> <property name="log.encoding" value="UTF-8"/>log.pattern(logging output format)-
The
log.patternproperty specifies the appearance of log messages using a format string. For example, a log pattern%date %-5level %logger{0} - %message%nwould result in messages such as this one:2013-03-11 16:55:34,137 DEBUG AmbientDataContext - Setting current ambient data context: com.tridion.ambientdata.web.WebContext. Refer to the online Logback documentation for more information. log.history(number of log files)-
The
log.historyproperty specifies the number of log files to back up (the default is 7 files). log.folder(logging location)-
The
log.folderproperty specifies the location where log files are saved (defaults to ./logs, that is, the logs/ subfolder of the root location of the Role). You can change this location if you want. -
For example, on the Content Manager Server, you could set the log location to TRIDION_HOME/log, where TRIDION_HOME is the value of the
%TRIDION_HOME%environment variable, with the backslashes replaced with forward slashes. By default, the value is c:/Program Files/SDL Web/. If your system was upgraded from a release before SDL Web 8, the value defaults to c:/Program Files/Tridion. log.level(logging level)-
To change the default logging level, change the value of the
log.levelproperty to one of the values describes in the following table. Note that logging levels are incremental and inclusive; each level logs data for the previous levels. For example,DEBUGalso logs and events covered byINFO,WARN, andERROR.Logging Level Description OFFTurn off logging. ERROR(default)Log events that cause a specific feature of the application to fail. WARNLog events that are potentially harmful. INFOLog neutral, informational messages about high-level functionality being executed. DEBUGLog fine-grained informational messages about low-level functionality being executed, intended to discover the source of a problem. TRACELog highly detailed informational messages about the application's lowest-level activity, ALLMaximum logging level that logs everything. Note: TheDEBUGlevel is intended for hunting down the origin of a particular problem only and will result in a significant performance drop while this level is set. Therefore, it is recommended to set the logging level back to as soon as the problem has been resolved. log.encoding(logging encoding)-
The encoding used when writing log files. For example,
UTF-16.
- To specify parameters rather than hardcoded values in logback.xml, refer to the "Variable substitution" section on this webpage: http://logback.qos.ch/manual/configuration.html.
- If you want to enable Logback to apply your configuration changes without having to restart your web application, use the
scanandscanPeriodattributes in theconfigurationelement. Refer to http://logback.qos.ch/manual/configuration.html#autoScan. - Save and close
logback.xml. - Restart your Content Delivery role or web application.