Activating debug mode in 2018.02 and later
- Set the system environment variable LOG4J_DEBUG to true (system wide environment variable or local variable for the same service account the forecasting shell is running).
- Set logging / debugEnable to true in the clientConfig.xml. (Temporarily rename the clientConfig file for an OC to prevent it is overwritten with the uploaded file)
Logging up to 2017.02 using a Log4jConfig.xml
Configuring the log.txt file of FEWS can be done using the Log4jConfig.xml in the root of the FEWS directory. The logging is done using the log4j framework. See: http://logging.apache.org/log4j/1.2/
The default log file is configured as follows using the Log4jConfig.xml:
Code Block | ||||
---|---|---|---|---|
| ||||
<appender name="defaultLogFile" class="org.apache.log4j.FileAppender"> <param name="File" value="${log.file.path}"/> <param name="Append" value="false"/> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="[%d] %p - %C{1}.%M - %m%n"/> </layout> </appender> |
Note that Append is set to false (which is recommended to avoid creating very large log files), which means that FEWS will overwrite the logfile after a restart.
If append is set to false, at startup, FEWS will now rename the logfile with the .old extention (since 2015.01). This will make sure that one previous log file is available after FEWS started.
Alternatively, the logging can be configured using a so called RollingFileAppender. In this case the Append parameter is set to true. Now the size of the log files will be limited to a fixed size (20MB in the following example) and the number of backup copies is specified (MaxBackupIndex is 5 in this example). If a log file becomes larger than the specified size, a backup is created (creating files like: log.txt.1, log.txt.2, ...). Also after a restart, FEWS will append to the existing log files.
Configuring the default log file using a rolling file appender is configured as follows using the Log4jConfig.xml:
Code Block | ||||
---|---|---|---|---|
| ||||
<appender name="defaultLogFile" class="org.apache.log4j.RollingFileAppender"> <param name="File" value="${log.file.path}"/> <param name="MaxFileSize" value="20MB"/> <!-- Keep 5 backup file --> <param name="MaxBackupIndex" value="5"/> <param name="Append" value="true"/> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="[%d] %p - %C{1}.%M - %m%n"/> </layout> </appender> |
How to activate debug logging
Additional debug mode logging can be activated by editing the appropriate log configuration file and restarting the component.
At the bottom of relvant log4j configuration file alter the
Code Block | ||
---|---|---|
| ||
... <root> <priority value="INFO"/> ... |
into
Code Block | ||
---|---|---|
| ||
... <root> <priority value="DEBUG"/> ... |
The following table shows for the most relevant components what log configuration files are available:
Component | Log configuration |
---|---|
Operator Client | Log4jConfig.xml |
ConfigManager | Log4jConfig-ConfigurationManager.xml |
Forecasting Shell | Log4jConfig-MCListener.xml, Log4jConfig-MCLogCollectorService.xml |
Master controller | Log4jConfig-FSListener.xml, Log4jConfig-MCLogCollectorService.xml, Log4jConfig-MCRestarter.xml, Log4jConfig-OCListener.xml, Log4jConfig-RemoteQueueProxy.xml, Log4jConfig-Synchronisation.xml, Log4jConfig-SystemMonitor.xml, Log4jConfig-TaskManager.xml |