The message destinations are defined by appenders. Log4j provides a number of different predefined appenders, including the following:
File appender
The messages are written to a file.
Console appender
The messages are written to
System.out
orSystem.err
.Socket appender
The messages are written to a socket and can thus also be sent between computers to a Log4j socket reader that can further process the messages (see Configuring the BeanConnect Management Console as a Log4j socket reader for the resource adapter and for the proxy).
Rolling file appender
The messages are written to a file. When the specified extent threshold is reached, the file is closed and the messages are written to a new trace file.
The logging events transferred to a logger are output through the appender(s) assigned to the logger.
Example 23 Output of logging events through the appender
If there is a logger called Trace
to which the appenders Console
(console appender) and File
(file appender) are assigned, any message that is output by this logger is output through both the file appender and the console appender. It thus appears both in the file and on the console.