Versions Compared

Key

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

 

 

Configuring the log.txt file of FEWS can be done using the Log4jConfig.xml in the root of the FEWS directory.


By default the log file is configured as follows:

<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">
<!-- [Date] Priority - category - Message\n -->
<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, just before shutdown, FEWS will now make a copy of the logfile with the .old extention (since 2015.01). This will make sure that one previous log file is available.

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.

<appender name="defaultLogFile" class="org.apache.log4j.RollingFileAppender">
<param name="File" value="${log.file.path}

...