FMS Log4j based Logging Configuration

The FMS logging sub system generates log messages at various levels which can be routed to various log files and various external logging systems. The logs provide a trace of messaging transactions, debug statements and errors.

Log4j logging configuration files are located in the log subdirectory of the FMS installation directory.

The following Log4j configuration illustrates using the operating system logging infrastructure.

\
\! Set root category threshhold to INFO and log to Syslog
\log4j.rootCategory=INFO, Syslog
\! Syslog is set to be a SyslogAppender.
\log4j.appender.Syslog=org.apache.log4j.net.SyslogAppender
\! Syslog uses PatternLayout.
\log4j.appender.Syslog.layout=org.apache.log4j.PatternLayout
\! The logging pattern to use, see below.
\log4j.appender.Syslog.layout.ConversionPattern=%-5p %m%n
\! Set Syslog properties.
\log4j.appender.Syslog.SyslogHost=localhost
\log4j.appender.Syslog.Facility=INFO
\log4j.appender.Syslog.FacilityPrinting=true
\
\! If Syslog4j is installed:
\! Syslog4j provides client (UDP, TCP, TCP over SSL/TLS, Native Unix syslog, and Unix socket) and server (TCP, TCP over SSL/TLS, and UDP) implementations of the BSD Syslog protocol
\! Also see http://www.productivity.org/projects/syslog4j/old/
\! Syslog is set to be a Syslog4jAppender.
\! log4j.appender.Syslog=org.productivity.java.syslog4j.impl.log4j.Syslog4jAppender
\! log4j.appender.Syslog.Protocol=unix_syslog
\! log4j.appender.Syslog.Threshold=INFO
\! log4j.appender.Syslog.layout=org.apache.log4j.PatternLayout
\! log4j.appender.Syslog.layout.ConversionPattern=%-5p %m%n
\
\    

The following Log4j configuration illustrates using a file based logging infrastructure.

\
\!Set root category threshhold to INFO and log to dest2
\log4j.rootCategory=INFO, dest2
\! Load a Rolling File Appender as our destination
\log4j.appender.dest2=org.apache.log4j.RollingFileAppender
\! This appender will only log messages with priority equal to or higher than
\! the one specified here
\log4j.appender.dest2.Threshold=INFO
\! Specify the logging file name
\log4j.appender.dest2.File=/var/log/fms/fms.log
\! Don't overwrite, append
\log4j.appender.dest2.Append=true
\log4j.appender.dest2.layout=org.apache.log4j.PatternLayout
\! The logging pattern to use, see below.
\log4j.appender.dest2.layout.ConversionPattern=%d{dd MMM yyyy HH:mm:ss,SSS} %-5p %m%n
\! Control the maximum log file size
\log4j.appender.dest2.MaxFileSize=512KB
\! Keep backup file(s) (backups will be in filename.1, .2 etc.)
\log4j.appender.dest2.MaxBackupIndex=10
\
\    

The log file formate may be customised as follows

\
\<date> <granularity> [<thread>,<classname>:<lineNumber>] 
\<message> [<internalTrackingID>, <messageTrackingID>]
\
\    

The logging format can be modified by editing the required log4j.properties file.

Table 1. Table of log4j arguments with their descriptions

ArgumentDescription
%nA new line follows.
%mLog message. <message> <InternalTrackingID> (if applicable) <messageTrackingID> (if applicable)
%pPriority. The Logging Level of this message.
%rmillisecs since program started running.
%cname of your category (logger),%c{2} will output the last two components.
%tName of current thread.
%dDate and time, also %d{ISO8601}, %d{DATE}, %d{ABSOLUTE}, %d{HH:mm:ss,SSS}, %d{dd MMM yyyy HH:mm:ss,SSS}
%lLong. Equivalent to %F%L%C%M
%FJava source file name.
%LJava source line number.
%CJava class name, %C{1} will output the last one component.
%MJava method name.

Table 2. Log Message Components.

ComponentDescription
<message>The Log Message
<InternalTrackingID>Used by the FMS server to keep record of where messages were sent from so that returned messages will have correct destination. This is required as the server does not only deal with one message at a time.
<messageTrackingID>Only applicable in situations where an actual message that was sent to or received by the server(eg: an Invoice) was associated with a particular log message.

Levels of Granularity

Table 3. Log Granularity

Logging LevelSemantic Level
TRACELog TRACE messages and include all messages as below.
DEBUGLog DEBUG messages and includes all messages as below.
INFOLog INFO messages and include all messages as below.
WARNLog WARN messages and include all messages as below.
ERRORLog ERROR messages and include all messages as below.
FATALQuiet. Only logs fatal errors.