Logging Configuration File

Top  Previous  Next

This section describes the default logging configuration file along with some details common to AggreGate Server logging configuration.

Here is the default config:

<?xml version="1.0" encoding="UTF-8" ?>

<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">

<log4j:configuration debug="false" xmlns:log4j="http://jakarta.apache.org/log4j/">

 

 <appender name="console" class="org.apache.log4j.ConsoleAppender">

   <param name="threshold" value="debug"/>

 <layout class="org.apache.log4j.PatternLayout">

     <param name="ConversionPattern" value="%d{HH:mm:ss,SSS} %-5p %-25c %m     -     [%t] %C.%M (%F:%L)%n"/>

   </layout>

 </appender>

 

 <appender name="file" class="org.apache.log4j.DailyRollingFileAppender">

   <param name="threshold" value="debug"/>

   <param name="file" value="server.log"/>

   <param name="append" value="true"/>

   <param name="DatePattern" value=".yyyy-MM-dd"/>

   <layout class="org.apache.log4j.PatternLayout">

     <param name="ConversionPattern" value="%d{dd.MM.yyyy HH:mm:ss,SSS} %-5p %-25c %m     -     [%t] %C.%M (%F:%L)%n"/>

   </layout>

 </appender>

 

 <category name="org.apache">

   <level value="error"/>

 </category>

 

 <logger name="ag" additivity="false">

   <level value="warn"/>

   <appender-ref ref="file"/>

   <appender-ref ref="console"/>

 </logger>

 

 <logger name="ag.alerts">

   <level value="info"/>

 </logger>

 

 <!-- Other logging categories are skipped -->

 

 <root>

   <priority value="warn"/>

   <appender-ref ref="console"/>

   <appender-ref ref="file"/>

 </root>

 

</log4j:configuration>

The default logging configuration is represented by a root configuration element, two appenders (destinations for log output) and several named logging categories. The root element (<root>) defines the global logging level as warning (<priority value="warn"/>) (see logging levels for more information). It applies to all messages coming from the system libraries used by the server core.

Logging of the server itself is performed using info level. This is specified by the <level value="info"/> tag that is located in <logger name="ag.*">. To switch the server to debug-level logging in a certain category, change this tag to <level value="debug"/>. The <logger> elements define which level is used for logging from each subsystem of AggreGate Server.

This logging configuration also defines two appenders named CONSOLE and FILE. An Appender is a destination for logging output. It can be a text file, e-mail message etc (see below for a complete listing of all available appenders).

Each appender is configured by its own <appender> element. This element must also specify a name of Java class responsible for this appender. In the listing above both appenders include a <layout> elements, that defines how the logged information will be formatted. The FILE appender includes several other <param> elements containing some additional options. For more information, consult manuals or books mentioned in logging framework documentation sources chapter.

More About Appenders (An Edited Excerpt From The Log4j Manual)

Log4j allows logging requests to print to multiple destinations. In log4j speak, an output destination is called an appender. Currently, appenders exist for the console, files, GUI components, remote socket servers, JMS, NT Event Loggers, and remote UNIX Syslog daemons. More than one appender can be attached to a logger.

Here is a brief list of available appenders:

Common Appenders

FileAppender, appends log events to a file.

RollingFileAppender, extends FileAppender to backup the log files when they reach a certain size.

DailyRollingFileAppender, extends FileAppender so that the underlying file is rolled over at a user-specified frequency.

ConsoleAppender,  appends log events to System.out or System.err using a layout specified by the user. The default target is System.out.

Network Appenders

SocketAppender, sends LoggingEvent objects to a remote a log server, usually a SocketNode.

SocketHubAppender, sends LoggingEvent objects to a set of remote log servers, usually a SocketNodes .

JMSAppender, a simple appender that publishes events to a JMS Topic. The events are serialized and transmitted as JMS message type ObjectMessage.

NTEventLogAppender, appends to the NT event log system.

Third-party Appenders

JDBCAppender

SNMPTrapAppender

Special Appenders

AsyncAppender, lets users log events asynchronously. It uses a bounded buffer to store logging events.

ExternallyRolledFileAppender, listens on a socket on the port specified by the PORT_OPTION for a "RollOver" message. When such a message is received, the underlying log file is rolled over and an acknowledgment message is sent back to the process initiating the roll over.

JDBCAppender, provides for sending log events to a database.

SMTPAppender, sends an e-mail when a specific logging event occurs, typically on errors or fatal errors.

SyslogAppender, sends messages to a remote syslog daemon.

TelnetAppender is a log4j appender that specializes in writing to a read-only socket.

WriterAppender, appends log events to a Writer or an OutputStream depending on the user's choice.