FMS | ||
---|---|---|
<<< Previous | Configuring FMS | Next >>> |
FMS provides extensive logging functionality using both the standard java logging subsystem and the highly flexible Log4j logging subsystem. These logging systems can be adjusted as described in appendix ...
The log4j logging facility requires configuration before it can be used effectively. The configuration files and associated configuration options are as below
log4j.properties.logfile - This file contains the default settings for FMS when logging to a rolling log file. Copy this file to log4j.properties in order to send logging information to the file associated with the log4j.appender.dest2.File entry.
log4j.properties.syslog - This file contains the default settings for FMS when logging to the system logger. Copy this file to log4j.properties in order to send logging information to the system logger associated with the log4j.appender.Syslog.Facility entry.
log4j.properties.mail - This file contains the default settings for FMS when logging to SMTP. Copy this file to log4j.properties in order to send logging information to the email address associated with the log4j.appender.mail.To entry.
log4j.properties.html - This file contains the default settings for FMS when logging to a HTML page. Copy this file to log4j.properties in order to send logging information to a HTML page associated with the log4j.appender.html.File entry.
Note: Logging in any level below WARN is intensive on the system and might slow down message transmission times. For decreased transmission times set the Log Level to either WARN or higher (ERROR) in a production environment.
The default log4j.properties file typically exists in the same directory that the FMS program files are installed. This may be changed by adding -Dlog4j.configuration=file:/path/to/log4j.properties to the java command line as follows
\ \ exec java -Dlog4j.configuration=file:///path/to/log4j.properties -server -cp ${FMSLIBDIR} \ \ -jar ${FMSLIBDIR}/fms.jar $* 2>> ${FMSLOGDIR}/err.log >> ${FMSLOGDIR}/out.log \ \ |
Further details for the log4j logging facility and configuration are available at http://logging.apache.org/log4j/docs/ and https://www.tutorialspoint.com/log4j/index.htm.
The log4j log files may be rotated using the configuration directly or alternatively using the logrotate facility of the operating system as per the following example typically in /etc/logrotate.d/fms for *nix based operating systems
\ \# Rotate script for fms \/usr/local/fms/log/fms.log { \ size 10M \ missingok \ rotate 100 \ create 644 fms fms \ compress \ sharedscripts \} \ \/usr/local/fms/log/error.log { \ size 10M \ missingok \ rotate 100 \ dateext \ create 644 fms fms \ compress \ sharedscripts \} \ \/usr/local/fms/log/out.log { \ daily \ missingok \ notifempty \ rotate 356 \ dateext \ create 644 fms fms \ compress \ sharedscripts \} \ \/usr/local/fms/log/err.log { \ daily \ missingok \ notifempty \ rotate 356 \ dateext \ create 644 fms fms \ compress \ sharedscripts \} \ \ |
FMS uses the rsyslogd logging facility on linux operating systems. Other operating systems like *nix and MAC OS X may use syslog for logging purposes which follow a similar approach described here. The Windows operating system uses it's own logging framework which is not documented here.
The rsyslog facility requires configuration before it can be used. Below are a number of suggested steps to perform for rsyslog and log4j.properties:
By default messages from FMS are logged to files in the /var/log/fms/ directory on *nix systems. If a different syslog facility, as defined in log4j.properties, is required, for example LOCAL0 then the system logger configuration file, typically /etc/rsyslog.conf for Redhat systems or /etc/rsyslog.d/50-default.conf for Ubuntu systems , needs to include an entry as follows:
\ \ # User log files \ local0.* /var/log/fms/fms-local.log \ \ |
and the configuration log4j.properties file, with the log4j.appender.Syslog.Facility=LOCAL0 definition, typically as follows
\ \log4j.rootCategory=TRACE, Syslog \log4j.appender.Syslog=org.productivity.java.syslog4j.impl.log4j.Syslog4jAppender \# The following entry requires an entry as follows in /etc/rsyslog.d/50-default.conf. Ensure fms-local.log has write permissions for syslog. \log4j.appender.Syslog.Facility=LOCAL0 \log4j.appender.Syslog.Protocol=unix_syslog \log4j.appender.Syslog.Threshold=TRACE \log4j.appender.Syslog.layout=org.apache.log4j.PatternLayout \log4j.appender.Syslog.layout.ConversionPattern=%d{ISO8601} %-5p SID:%X{sid} ID:%X{msgid} FROM:%X{from} TO:%X{to} %X{cmd} %m%n \ \ |
Alternatively log messages from FMS may be sent to a remote syslog server by using the following log4j.properties configuration.
\ \log4j.rootCategory=TRACE, Syslog \log4j.appender.Syslog=org.apache.log4j.net.SyslogAppender \log4j.appender.Syslog.Threshold=DEBUG \log4j.appender.Syslog.layout=org.apache.log4j.PatternLayout \log4j.appender.Syslog.layout.ConversionPattern=fms.flame.business %-5p SID:%X{sid} ID:%X{msgid} FROM:%X{from} TO:%X{to} %X{cmd} %m%n \log4j.appender.Syslog.SyslogHost=syslog.flame.business:6514 \ \ |
Restart FMS and reload the system logger in order for the changes to be in effect. Also ensure that permissons permit writing to file fms-local.log by the rsyslog process of logging locally. Note that the facility (LOCAL0) is case insensitive.
<<< Previous | Home | Next >>> |
Triggers | Up | Altering Log4j Configuration Files |