Log4j Appenders

Log4j allows logging requests to print to multiple destinations such as console, files, GUI components, remote socket servers, JMS, NT Event Loggers, and remote UNIX Syslog daemons. In log4j speak, an output destination is called an appender. It is also possible to log asynchronously.

More than one appender can be attached to a logger.

Available Appenders are :

Appender Description
AppenderSkeleton Provides the code for common functionality, such as support for threshold filtering and support for general filters.
AsyncAppender The AsyncAppender lets users log events asynchronously.

The AsyncAppender will collect the events sent to it and then dispatch them to all the appenders that are attached to it. You can attach multiple appenders to an AsyncAppender.

The AsyncAppender uses a separate thread to serve the events in its buffer.
ConsoleAppender ConsoleAppender appends log events to System.out or System.err using a layout specified by the user. The default target is System.out.
DailyRollingFileAppender DailyRollingFileAppender extends FileAppender so that the underlying file is rolled over at a user chosen frequency.

For example, if the File option is set to /filename.log and the DatePattern set to ‘.’yyyy-MM-dd, on 2012-12-28 at midnight, the logging file /filename.log will be copied to /filename.log.2012-12-28 and logging for 2012-12-29 will continue in /filename.log until it rolls over the next day.
ExternallyRolledFileAppender This appender listens on a socket on the port specified by the Port property 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.
FileAppender FileAppender appends log events to a file.
JDBCAppender The JDBCAppender provides for sending log events to a database.
JDBCAppender The JDBCAppender provides for sending log events to a database.
JMSAppender A simple appender that publishes events to a JMS Topic. The events are serialized and transmitted as JMS message type ObjectMessage.
LF5Appender LF5Appender logs events to a swing based logging console. The swing console supports turning categories on and off, multiple detail level views, as well as full text searching and many other capabilties.
NTEventLogAppender Append to the NT event log system.

WARNING This appender can only be installed and used on a Windows system.

Note : Do not forget to place NTEventLogAppender.dll, NTEventLogAppender.amd64.dll, NTEventLogAppender.ia64.dll or NTEventLogAppender.x86.dll as appropriate in a directory that is on the PATH of the Windows system. Otherwise, you will get a java.lang.UnsatisfiedLinkError.
NullAppender A NullAppender merely exists, it never outputs a message to any device.
RewriteAppender This appender forwards a logging request to another appender after possibly rewriting the logging event. This appender (with the appropriate policy) replaces the MapFilter, PropertyFilter and ReflectionFilter.
RollingFileAppender RollingFileAppender extends FileAppender to backup the log files when they reach a certain size.
SMTPAppender Send an e-mail when a specific logging event occurs, typically on errors or fatal errors.
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.
SyslogAppender Use SyslogAppender to send log messages to a remote syslog daemon.
TelnetAppender The TelnetAppender is a log4j appender that specializes in writing to a read-only socket. The output is provided in a telnet-friendly way so that a log can be monitored over TCP/IP. Clients using telnet connect to the socket and receive log data. This is handy for remote monitoring, especially when monitoring a servlet.
WriterAppender WriterAppender appends log events to a Writer or an OutputStream depending on the user’s choice.


Comments are closed.