org.dcm4che2.audit.log4j.net
Class SyslogAppender

java.lang.Object
  extended by org.apache.log4j.AppenderSkeleton
      extended by org.dcm4che2.audit.log4j.net.SyslogAppender
All Implemented Interfaces:
org.apache.log4j.Appender, org.apache.log4j.spi.OptionHandler

public class SyslogAppender
extends org.apache.log4j.AppenderSkeleton

Use SyslogAppender to send log messages to a remote syslog daemon.

Author:
Ceki Gülcü, Anders Kristensen

Field Summary
protected static int FACILITY_OI
           
static int LOG_AUTH
          security/authorization messages
static int LOG_AUTHPRIV
          security/authorization messages (private)
static int LOG_CRON
          clock daemon
static int LOG_DAEMON
          System daemons
static int LOG_FTP
          ftp daemon
static int LOG_KERN
          Kernel messages
static int LOG_LOCAL0
          reserved for local use
static int LOG_LOCAL1
          reserved for local use
static int LOG_LOCAL2
          reserved for local use
static int LOG_LOCAL3
          reserved for local use
static int LOG_LOCAL4
          reserved for local use
static int LOG_LOCAL5
          reserved for local use
static int LOG_LOCAL6
          reserved for local use
static int LOG_LOCAL7
          reserved for local use
static int LOG_LPR
          line printer subsystem
static int LOG_MAIL
          Mail system
static int LOG_NEWS
          network news subsystem
static int LOG_SYSLOG
          messages generated internally by syslogd
static int LOG_USER
          Random user-level messages
static int LOG_UUCP
          UUCP subsystem
static int PRI_ALERT
          action must be taken immediately
static int PRI_CRITICAL
          critical conditions
static int PRI_DEBUG
          debug-level messages
static int PRI_EMERGENCY
          system is unusable
static int PRI_ERROR
          error conditions
static int PRI_INFORMATIONAL
          informational messages
static int PRI_NOTICE
          normal but significant condition
static int PRI_WARNING
          warning conditions
protected static int SYSLOG_HOST_OI
           
 
Fields inherited from class org.apache.log4j.AppenderSkeleton
closed, errorHandler, headFilter, layout, name, tailFilter, threshold
 
Constructor Summary
SyslogAppender()
           
SyslogAppender(org.apache.log4j.Layout layout, int syslogFacility)
           
SyslogAppender(org.apache.log4j.Layout layout, java.lang.String syslogHost, int syslogFacility)
           
 
Method Summary
 void activateOptions()
          This method returns immediately as options are activated when they are set.
 void append(org.apache.log4j.spi.LoggingEvent event)
           
 void close()
          Release any resources held by this SyslogAppender.
 int getDebugPriority()
           
 java.lang.String getEncoding()
           
 int getErrorPriority()
           
 java.lang.String getFacility()
          Returns the value of the Facility option.
static int getFacility(java.lang.String facilityName)
          Returns the integer value corresponding to the named syslog facility, or -1 if it couldn't be recognized.
static java.lang.String getFacilityString(int syslogFacility)
          Returns the specified syslog facility as a lower-case String, e.g.
 int getFatalPriority()
           
 int getInfoPriority()
           
 java.lang.String getLocalHostname()
           
 java.lang.String getSyslogHost()
          Returns the value of the SyslogHost option.
 int getWarnPriority()
           
 boolean requiresLayout()
          The SyslogAppender requires a layout.
 void setDebugPriority(int debugPriority)
           
 void setEncoding(java.lang.String encoding)
           
 void setErrorPriority(int errorPriority)
           
 void setFacility(java.lang.String facilityName)
          Set the syslog facility.
 void setFatalPriority(int fatalPriority)
           
 void setInfoPriority(int infoPriority)
           
 void setSyslogHost(java.lang.String syslogHost)
          The SyslogHost option is the name of the the syslog host where log output should go.
 void setWarnPriority(int warnPriority)
           
 
Methods inherited from class org.apache.log4j.AppenderSkeleton
addFilter, clearFilters, doAppend, finalize, getErrorHandler, getFilter, getFirstFilter, getLayout, getName, getThreshold, isAsSevereAsThreshold, setErrorHandler, setLayout, setName, setThreshold
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG_KERN

public static final int LOG_KERN
Kernel messages

See Also:
Constant Field Values

LOG_USER

public static final int LOG_USER
Random user-level messages

See Also:
Constant Field Values

LOG_MAIL

public static final int LOG_MAIL
Mail system

See Also:
Constant Field Values

LOG_DAEMON

public static final int LOG_DAEMON
System daemons

See Also:
Constant Field Values

LOG_AUTH

public static final int LOG_AUTH
security/authorization messages

See Also:
Constant Field Values

LOG_SYSLOG

public static final int LOG_SYSLOG
messages generated internally by syslogd

See Also:
Constant Field Values

LOG_LPR

public static final int LOG_LPR
line printer subsystem

See Also:
Constant Field Values

LOG_NEWS

public static final int LOG_NEWS
network news subsystem

See Also:
Constant Field Values

LOG_UUCP

public static final int LOG_UUCP
UUCP subsystem

See Also:
Constant Field Values

LOG_CRON

public static final int LOG_CRON
clock daemon

See Also:
Constant Field Values

LOG_AUTHPRIV

public static final int LOG_AUTHPRIV
security/authorization messages (private)

See Also:
Constant Field Values

LOG_FTP

public static final int LOG_FTP
ftp daemon

See Also:
Constant Field Values

LOG_LOCAL0

public static final int LOG_LOCAL0
reserved for local use

See Also:
Constant Field Values

LOG_LOCAL1

public static final int LOG_LOCAL1
reserved for local use

See Also:
Constant Field Values

LOG_LOCAL2

public static final int LOG_LOCAL2
reserved for local use

See Also:
Constant Field Values

LOG_LOCAL3

public static final int LOG_LOCAL3
reserved for local use

See Also:
Constant Field Values

LOG_LOCAL4

public static final int LOG_LOCAL4
reserved for local use

See Also:
Constant Field Values

LOG_LOCAL5

public static final int LOG_LOCAL5
reserved for local use

See Also:
Constant Field Values

LOG_LOCAL6

public static final int LOG_LOCAL6
reserved for local use

See Also:
Constant Field Values

LOG_LOCAL7

public static final int LOG_LOCAL7
reserved for local use

See Also:
Constant Field Values

PRI_EMERGENCY

public static final int PRI_EMERGENCY
system is unusable

See Also:
Constant Field Values

PRI_ALERT

public static final int PRI_ALERT
action must be taken immediately

See Also:
Constant Field Values

PRI_CRITICAL

public static final int PRI_CRITICAL
critical conditions

See Also:
Constant Field Values

PRI_ERROR

public static final int PRI_ERROR
error conditions

See Also:
Constant Field Values

PRI_WARNING

public static final int PRI_WARNING
warning conditions

See Also:
Constant Field Values

PRI_NOTICE

public static final int PRI_NOTICE
normal but significant condition

See Also:
Constant Field Values

PRI_INFORMATIONAL

public static final int PRI_INFORMATIONAL
informational messages

See Also:
Constant Field Values

PRI_DEBUG

public static final int PRI_DEBUG
debug-level messages

See Also:
Constant Field Values

SYSLOG_HOST_OI

protected static final int SYSLOG_HOST_OI
See Also:
Constant Field Values

FACILITY_OI

protected static final int FACILITY_OI
See Also:
Constant Field Values
Constructor Detail

SyslogAppender

public SyslogAppender()

SyslogAppender

public SyslogAppender(org.apache.log4j.Layout layout,
                      int syslogFacility)

SyslogAppender

public SyslogAppender(org.apache.log4j.Layout layout,
                      java.lang.String syslogHost,
                      int syslogFacility)
Method Detail

close

public void close()
Release any resources held by this SyslogAppender.

Since:
0.8.4

getFacilityString

public static java.lang.String getFacilityString(int syslogFacility)
Returns the specified syslog facility as a lower-case String, e.g. "kern", "user", etc.


getFacility

public static int getFacility(java.lang.String facilityName)
Returns the integer value corresponding to the named syslog facility, or -1 if it couldn't be recognized.

Parameters:
facilityName - one of the strings KERN, USER, MAIL, DAEMON, AUTH, SYSLOG, LPR, NEWS, UUCP, CRON, AUTHPRIV, FTP, LOCAL0, LOCAL1, LOCAL2, LOCAL3, LOCAL4, LOCAL5, LOCAL6, LOCAL7. The matching is case-insensitive.
Since:
1.1

getLocalHostname

public java.lang.String getLocalHostname()

getFatalPriority

public final int getFatalPriority()

setFatalPriority

public final void setFatalPriority(int fatalPriority)

getErrorPriority

public final int getErrorPriority()

setErrorPriority

public final void setErrorPriority(int errorPriority)

getWarnPriority

public final int getWarnPriority()

setWarnPriority

public final void setWarnPriority(int warnPriority)

getInfoPriority

public final int getInfoPriority()

setInfoPriority

public final void setInfoPriority(int infoPriority)

getDebugPriority

public final int getDebugPriority()

setDebugPriority

public final void setDebugPriority(int debugPriority)

getEncoding

public final java.lang.String getEncoding()

setEncoding

public final void setEncoding(java.lang.String encoding)

append

public void append(org.apache.log4j.spi.LoggingEvent event)
Specified by:
append in class org.apache.log4j.AppenderSkeleton

activateOptions

public void activateOptions()
This method returns immediately as options are activated when they are set.

Specified by:
activateOptions in interface org.apache.log4j.spi.OptionHandler
Overrides:
activateOptions in class org.apache.log4j.AppenderSkeleton

requiresLayout

public boolean requiresLayout()
The SyslogAppender requires a layout. Hence, this method returns true.

Since:
0.8.4

setSyslogHost

public void setSyslogHost(java.lang.String syslogHost)
The SyslogHost option is the name of the the syslog host where log output should go. A non-default port can be specified by appending a colon and port number to a host name, an IPv4 address or an IPv6 address enclosed in square brackets. WARNING If the SyslogHost is not set, then this appender will fail.


getSyslogHost

public java.lang.String getSyslogHost()
Returns the value of the SyslogHost option.


setFacility

public void setFacility(java.lang.String facilityName)
Set the syslog facility. This is the Facility option.

The facilityName parameter must be one of the strings KERN, USER, MAIL, DAEMON, AUTH, SYSLOG, LPR, NEWS, UUCP, CRON, AUTHPRIV, FTP, LOCAL0, LOCAL1, LOCAL2, LOCAL3, LOCAL4, LOCAL5, LOCAL6, LOCAL7. Case is unimportant.

Since:
0.8.1

getFacility

public java.lang.String getFacility()
Returns the value of the Facility option.



Copyright © 2011 dcm4che. All Rights Reserved.