org.productivity.java.syslog4j.impl.backlog.log4j
Class Log4jSyslogBackLogHandler

java.lang.Object
  extended by org.productivity.java.syslog4j.impl.backlog.AbstractSyslogBackLogHandler
      extended by org.productivity.java.syslog4j.impl.backlog.log4j.Log4jSyslogBackLogHandler
All Implemented Interfaces:
SyslogBackLogHandlerIF

public class Log4jSyslogBackLogHandler
extends AbstractSyslogBackLogHandler

Log4jSyslogBackLogHandler is used to send Syslog backLog messages to Log4j whenever the Syslog protocol fails.

Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy of the LGPL license is available in the META-INF folder in all distributions of Syslog4j and in the base directory of the "doc" ZIP.

Version:
$Id: Log4jSyslogBackLogHandler.java,v 1.2 2009/07/22 15:54:23 cvs Exp $
Author:
<syslog4j@productivity.org>

Field Summary
protected  org.apache.log4j.Level downLevel
           
protected  org.apache.log4j.Logger logger
           
protected  org.apache.log4j.Level upLevel
           
 
Fields inherited from class org.productivity.java.syslog4j.impl.backlog.AbstractSyslogBackLogHandler
appendReason
 
Constructor Summary
Log4jSyslogBackLogHandler(java.lang.Class loggerClass)
           
Log4jSyslogBackLogHandler(java.lang.Class loggerClass, boolean appendReason)
           
Log4jSyslogBackLogHandler(org.apache.log4j.Logger logger)
           
Log4jSyslogBackLogHandler(org.apache.log4j.Logger logger, boolean appendReason)
           
Log4jSyslogBackLogHandler(java.lang.String loggerName)
           
Log4jSyslogBackLogHandler(java.lang.String loggerName, boolean appendReason)
           
Log4jSyslogBackLogHandler(java.lang.String loggerName, org.apache.log4j.spi.LoggerFactory loggerFactory)
           
Log4jSyslogBackLogHandler(java.lang.String loggerName, org.apache.log4j.spi.LoggerFactory loggerFactory, boolean appendReason)
           
 
Method Summary
 void down(SyslogIF syslog, java.lang.String reason)
          Implement down(syslog,reason) to notify/log when the syslog protocol is unavailable.
protected static org.apache.log4j.Level getLog4jLevel(int level)
           
 void initialize()
          Implement initialize() to handle one-time set-up for this backLog handler.
 void log(SyslogIF syslog, int level, java.lang.String message, java.lang.String reason)
           
 void up(SyslogIF syslog)
          Implement up(syslog) to notify/log when the syslog protocol becomes available after a down condition.
 
Methods inherited from class org.productivity.java.syslog4j.impl.backlog.AbstractSyslogBackLogHandler
combine
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected org.apache.log4j.Logger logger

downLevel

protected org.apache.log4j.Level downLevel

upLevel

protected org.apache.log4j.Level upLevel
Constructor Detail

Log4jSyslogBackLogHandler

public Log4jSyslogBackLogHandler(org.apache.log4j.Logger logger)
                          throws SyslogRuntimeException
Throws:
SyslogRuntimeException

Log4jSyslogBackLogHandler

public Log4jSyslogBackLogHandler(org.apache.log4j.Logger logger,
                                 boolean appendReason)

Log4jSyslogBackLogHandler

public Log4jSyslogBackLogHandler(java.lang.Class loggerClass)

Log4jSyslogBackLogHandler

public Log4jSyslogBackLogHandler(java.lang.Class loggerClass,
                                 boolean appendReason)

Log4jSyslogBackLogHandler

public Log4jSyslogBackLogHandler(java.lang.String loggerName)

Log4jSyslogBackLogHandler

public Log4jSyslogBackLogHandler(java.lang.String loggerName,
                                 boolean appendReason)

Log4jSyslogBackLogHandler

public Log4jSyslogBackLogHandler(java.lang.String loggerName,
                                 org.apache.log4j.spi.LoggerFactory loggerFactory)

Log4jSyslogBackLogHandler

public Log4jSyslogBackLogHandler(java.lang.String loggerName,
                                 org.apache.log4j.spi.LoggerFactory loggerFactory,
                                 boolean appendReason)
Method Detail

initialize

public void initialize()
                throws SyslogRuntimeException
Description copied from interface: SyslogBackLogHandlerIF
Implement initialize() to handle one-time set-up for this backLog handler.

Throws:
SyslogRuntimeException

getLog4jLevel

protected static org.apache.log4j.Level getLog4jLevel(int level)

down

public void down(SyslogIF syslog,
                 java.lang.String reason)
Description copied from interface: SyslogBackLogHandlerIF
Implement down(syslog,reason) to notify/log when the syslog protocol is unavailable.

Parameters:
syslog - - SyslogIF instance causing this down condition
reason - - reason given for the down condition

up

public void up(SyslogIF syslog)
Description copied from interface: SyslogBackLogHandlerIF
Implement up(syslog) to notify/log when the syslog protocol becomes available after a down condition.

Parameters:
syslog - - SyslogIF instance which is now available

log

public void log(SyslogIF syslog,
                int level,
                java.lang.String message,
                java.lang.String reason)
         throws SyslogRuntimeException
Parameters:
syslog - - SyslogIF instance which cannot handle this log event
level - - message level
message - - message (in String form)
reason - - reason given for why this message could not be handled
Throws:
SyslogRuntimeException - - throwing this Exception activates the next backlogHandler in the chain