You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Next »

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:

<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, 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.

Configuring the default log file using a rolling file appender is configured as follows using the Log4jConfig.xml:

<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>

 



  • No labels