org.productivity.java.syslog4j.impl
Class AbstractSyslog

java.lang.Object
  extended by org.productivity.java.syslog4j.impl.AbstractSyslog
All Implemented Interfaces:
java.io.Serializable, SyslogConstants, SyslogIF
Direct Known Subclasses:
AbstractNetSyslog, UnixSocketSyslog, UnixSyslog

public abstract class AbstractSyslog
extends java.lang.Object
implements SyslogIF

AbstractSyslog provides a base abstract implementation of the SyslogIF.

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: AbstractSyslog.java,v 1.29 2011/01/11 04:58:52 cvs Exp $
Author:
<syslog4j@productivity.org>
See Also:
Serialized Form

Field Summary
protected  boolean backLogStatus
           
protected  java.lang.Object backLogStatusSyncObject
           
protected  java.util.List notifiedBackLogHandlers
           
protected  SyslogMessageProcessorIF structuredSyslogMessageProcessor
           
protected  AbstractSyslogConfigIF syslogConfig
           
protected  SyslogMessageProcessorIF syslogMessageProcessor
           
protected  java.lang.String syslogProtocol
           
 
Fields inherited from interface org.productivity.java.syslog4j.SyslogConstants
AF_UNIX, CACHE_HOST_ADDRESS_DEFAULT, CHAR_SET_DEFAULT, CRLF, FACILITY_AUTH, FACILITY_AUTHPRIV, FACILITY_CRON, FACILITY_DAEMON, FACILITY_FTP, FACILITY_KERN, FACILITY_LOCAL0, FACILITY_LOCAL1, FACILITY_LOCAL2, FACILITY_LOCAL3, FACILITY_LOCAL4, FACILITY_LOCAL5, FACILITY_LOCAL6, FACILITY_LOCAL7, FACILITY_LPR, FACILITY_MAIL, FACILITY_NEWS, FACILITY_SYSLOG, FACILITY_USER, FACILITY_UUCP, IDENT_SUFFIX_DEFAULT, INCLUDE_IDENT_IN_MESSAGE_MODIFIER_DEFAULT, JNA_NATIVE_CLASS, LEVEL_ALERT, LEVEL_CRITICAL, LEVEL_DEBUG, LEVEL_EMERGENCY, LEVEL_ERROR, LEVEL_INFO, LEVEL_NOTICE, LEVEL_WARN, LF, MAX_MESSAGE_LENGTH_DEFAULT, MAX_QUEUE_SIZE_DEFAULT, MAX_SHUTDOWN_WAIT_DEFAULT, OPTION_LOG_CONS, OPTION_LOG_NDELAY, OPTION_LOG_NOWAIT, OPTION_LOG_ODELAY, OPTION_LOG_PERROR, OPTION_LOG_PID, OPTION_NONE, SEND_LOCAL_NAME_DEFAULT, SEND_LOCAL_NAME_DEFAULT_VALUE, SEND_LOCAL_TIMESTAMP_DEFAULT, SERVER_SHUTDOWN_WAIT_DEFAULT, SERVER_SOCKET_BACKLOG_DEFAULT, SHUTDOWN_INTERVAL, SOCK_DGRAM, SOCK_STREAM, SPLIT_MESSAGE_BEGIN_TEXT_DEFAULT, SPLIT_MESSAGE_END_TEXT_DEFAULT, STRUCTURED_DATA_APP_NAME_DEFAULT_VALUE, STRUCTURED_DATA_EMPTY_VALUE, STRUCTURED_DATA_NILVALUE, STRUCTURED_DATA_PROCESS_ID_DEFAULT_VALUE, SYSLOG_BUFFER_SIZE, SYSLOG_DATEFORMAT, SYSLOG_FACILITY_DEFAULT, SYSLOG_HOST_DEFAULT, SYSLOG_LIBRARY_DEFAULT, SYSLOG_MESSAGE_MODIFIER_PREFIX_DEFAULT, SYSLOG_MESSAGE_MODIFIER_SUFFIX_DEFAULT, SYSLOG_PATH_DEFAULT, SYSLOG_POOL_CONFIG_MAX_ACTIVE_DEFAULT, SYSLOG_POOL_CONFIG_MAX_IDLE_DEFAULT, SYSLOG_POOL_CONFIG_MAX_WAIT_DEFAULT, SYSLOG_POOL_CONFIG_MIN_EVICTABLE_IDLE_TIME_MILLIS_DEFAULT, SYSLOG_POOL_CONFIG_MIN_IDLE_DEFAULT, SYSLOG_POOL_CONFIG_NUM_TESTS_PER_EVICTION_RUN_DEFAULT, SYSLOG_POOL_CONFIG_SOFT_MIN_EVICTABLE_IDLE_TIME_MILLIS_DEFAULT, SYSLOG_POOL_CONFIG_TEST_ON_BORROW_DEFAULT, SYSLOG_POOL_CONFIG_TEST_ON_RETURN_DEFAULT, SYSLOG_POOL_CONFIG_TEST_WHILE_IDLE_DEFAULT, SYSLOG_POOL_CONFIG_TIME_BETWEEN_EVICTION_RUNS_MILLIS_DEFAULT, SYSLOG_PORT_DEFAULT, SYSLOG_SEQUENTIAL_MESSAGE_MODIFIER_FIRST_NUMBER_DEFAULT, SYSLOG_SEQUENTIAL_MESSAGE_MODIFIER_LAST_NUMBER_DEFAULT, SYSLOG_SEQUENTIAL_MESSAGE_MODIFIER_PAD_CHAR_DEFAULT, SYSLOG_SEQUENTIAL_MESSAGE_MODIFIER_PREFIX_DEFAULT, SYSLOG_SEQUENTIAL_MESSAGE_MODIFIER_SUFFIX_DEFAULT, SYSLOG_SEQUENTIAL_MESSAGE_MODIFIER_USE_PADDING_DEFAULT, SYSLOG_SOCKET_FAMILY_DEFAULT, SYSLOG_SOCKET_LIBRARY_DEFAULT, SYSLOG_SOCKET_PATH_DEFAULT, SYSLOG_SOCKET_PROTOCOL_DEFAULT, SYSLOG_SOCKET_TYPE_DEFAULT, TCP, TCP_DELIMITER_SEQUENCE_DEFAULT, TCP_FRESH_CONNECTION_INTERVAL_DEFAULT, TCP_KEEP_ALIVE_DEFAULT, TCP_MAX_ACTIVE_SOCKETS_BEHAVIOR_DEFAULT, TCP_MAX_ACTIVE_SOCKETS_DEFAULT, TCP_PERSISTENT_CONNECTION_DEFAULT, TCP_REUSE_ADDRESS_DEFAULT, TCP_SET_BUFFER_SIZE_DEFAULT, TCP_SO_LINGER_DEFAULT, TCP_SO_LINGER_SECONDS_DEFAULT, THREAD_LOOP_INTERVAL_DEFAULT, THREAD_PRIORITY_DEFAULT, THREADED_DEFAULT, THROW_EXCEPTION_ON_INITIALIZE_DEFAULT, THROW_EXCEPTION_ON_WRITE_DEFAULT, TRUNCATE_MESSAGE_DEFAULT, UDP, UNIX_SOCKET, UNIX_SYSLOG, USE_DAEMON_THREAD_DEFAULT, USE_STRUCTURED_DATA_DEFAULT, WRITE_RETRIES_DEFAULT
 
Constructor Summary
AbstractSyslog()
           
 
Method Summary
 void alert(java.lang.String message)
           
 void alert(SyslogMessageIF message)
           
 void backLog(int level, java.lang.String message, java.lang.String reason)
           
 void backLog(int level, java.lang.String message, java.lang.Throwable reasonThrowable)
           
 AbstractSyslogWriter createWriter()
           
 java.lang.Thread createWriterThread(AbstractSyslogWriter syslogWriter)
           
 void critical(java.lang.String message)
           
 void critical(SyslogMessageIF message)
           
 void debug(java.lang.String message)
           
 void debug(SyslogMessageIF message)
           
 void emergency(java.lang.String message)
           
 void emergency(SyslogMessageIF message)
           
 void error(java.lang.String message)
           
 void error(SyslogMessageIF message)
           
protected  boolean getBackLogStatus()
           
 SyslogConfigIF getConfig()
           
 SyslogMessageProcessorIF getMessageProcessor()
           
 java.lang.String getProtocol()
           
 SyslogMessageProcessorIF getStructuredMessageProcessor()
           
abstract  AbstractSyslogWriter getWriter()
           
 void info(java.lang.String message)
           
 void info(SyslogMessageIF message)
           
protected abstract  void initialize()
           
 void initialize(java.lang.String protocol, SyslogConfigIF config)
           
 void log(int level, java.lang.String message)
           
 void log(int level, SyslogMessageIF message)
           
 void log(SyslogMessageProcessorIF messageProcessor, int level, java.lang.String message)
           
protected  java.lang.String modifyMessage(int level, java.lang.String message)
           
 void notice(java.lang.String message)
           
 void notice(SyslogMessageIF message)
           
protected  java.lang.String prefixMessage(java.lang.String message, java.lang.String suffix)
           
abstract  void returnWriter(AbstractSyslogWriter syslogWriter)
           
 void setBackLogStatus(boolean backLogStatus)
           
 void setMessageProcessor(SyslogMessageProcessorIF messageProcessor)
           
 void setStructuredMessageProcessor(SyslogMessageProcessorIF messageProcessor)
           
 void warn(java.lang.String message)
           
 void warn(SyslogMessageIF message)
           
protected abstract  void write(int level, byte[] message)
           
protected  void write(SyslogMessageProcessorIF messageProcessor, int level, java.lang.String message)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.productivity.java.syslog4j.SyslogIF
flush, shutdown
 

Field Detail

syslogProtocol

protected java.lang.String syslogProtocol

syslogConfig

protected AbstractSyslogConfigIF syslogConfig

syslogMessageProcessor

protected SyslogMessageProcessorIF syslogMessageProcessor

structuredSyslogMessageProcessor

protected SyslogMessageProcessorIF structuredSyslogMessageProcessor

backLogStatusSyncObject

protected java.lang.Object backLogStatusSyncObject

backLogStatus

protected boolean backLogStatus

notifiedBackLogHandlers

protected java.util.List notifiedBackLogHandlers
Constructor Detail

AbstractSyslog

public AbstractSyslog()
Method Detail

getBackLogStatus

protected boolean getBackLogStatus()

setBackLogStatus

public void setBackLogStatus(boolean backLogStatus)
Parameters:
backLogStatus - - true if in a "down" backLog state, false if in an "up" (operational) non-backLog state

initialize

public void initialize(java.lang.String protocol,
                       SyslogConfigIF config)
                throws SyslogRuntimeException
Specified by:
initialize in interface SyslogIF
Throws:
SyslogRuntimeException

getMessageProcessor

public SyslogMessageProcessorIF getMessageProcessor()
Specified by:
getMessageProcessor in interface SyslogIF

getStructuredMessageProcessor

public SyslogMessageProcessorIF getStructuredMessageProcessor()
Specified by:
getStructuredMessageProcessor in interface SyslogIF

setMessageProcessor

public void setMessageProcessor(SyslogMessageProcessorIF messageProcessor)
Specified by:
setMessageProcessor in interface SyslogIF

setStructuredMessageProcessor

public void setStructuredMessageProcessor(SyslogMessageProcessorIF messageProcessor)
Specified by:
setStructuredMessageProcessor in interface SyslogIF

getProtocol

public java.lang.String getProtocol()
Specified by:
getProtocol in interface SyslogIF

getConfig

public SyslogConfigIF getConfig()
Specified by:
getConfig in interface SyslogIF

log

public void log(int level,
                java.lang.String message)
Specified by:
log in interface SyslogIF

log

public void log(int level,
                SyslogMessageIF message)
Specified by:
log in interface SyslogIF

debug

public void debug(java.lang.String message)
Specified by:
debug in interface SyslogIF

notice

public void notice(java.lang.String message)
Specified by:
notice in interface SyslogIF

info

public void info(java.lang.String message)
Specified by:
info in interface SyslogIF

warn

public void warn(java.lang.String message)
Specified by:
warn in interface SyslogIF

error

public void error(java.lang.String message)
Specified by:
error in interface SyslogIF

critical

public void critical(java.lang.String message)
Specified by:
critical in interface SyslogIF

alert

public void alert(java.lang.String message)
Specified by:
alert in interface SyslogIF

emergency

public void emergency(java.lang.String message)
Specified by:
emergency in interface SyslogIF

debug

public void debug(SyslogMessageIF message)
Specified by:
debug in interface SyslogIF

notice

public void notice(SyslogMessageIF message)
Specified by:
notice in interface SyslogIF

info

public void info(SyslogMessageIF message)
Specified by:
info in interface SyslogIF

warn

public void warn(SyslogMessageIF message)
Specified by:
warn in interface SyslogIF

error

public void error(SyslogMessageIF message)
Specified by:
error in interface SyslogIF

critical

public void critical(SyslogMessageIF message)
Specified by:
critical in interface SyslogIF

alert

public void alert(SyslogMessageIF message)
Specified by:
alert in interface SyslogIF

emergency

public void emergency(SyslogMessageIF message)
Specified by:
emergency in interface SyslogIF

prefixMessage

protected java.lang.String prefixMessage(java.lang.String message,
                                         java.lang.String suffix)

log

public void log(SyslogMessageProcessorIF messageProcessor,
                int level,
                java.lang.String message)

write

protected void write(SyslogMessageProcessorIF messageProcessor,
                     int level,
                     java.lang.String message)
              throws SyslogRuntimeException
Throws:
SyslogRuntimeException

initialize

protected abstract void initialize()
                            throws SyslogRuntimeException
Throws:
SyslogRuntimeException

write

protected abstract void write(int level,
                              byte[] message)
                       throws SyslogRuntimeException
Throws:
SyslogRuntimeException

modifyMessage

protected java.lang.String modifyMessage(int level,
                                         java.lang.String message)

backLog

public void backLog(int level,
                    java.lang.String message,
                    java.lang.Throwable reasonThrowable)
Specified by:
backLog in interface SyslogIF

backLog

public void backLog(int level,
                    java.lang.String message,
                    java.lang.String reason)
Specified by:
backLog in interface SyslogIF

getWriter

public abstract AbstractSyslogWriter getWriter()

returnWriter

public abstract void returnWriter(AbstractSyslogWriter syslogWriter)

createWriterThread

public java.lang.Thread createWriterThread(AbstractSyslogWriter syslogWriter)

createWriter

public AbstractSyslogWriter createWriter()