Package org.apache.log.format
Class SyslogFormatter
- java.lang.Object
-
- org.apache.log.format.SyslogFormatter
-
-
Field Summary
Fields Modifier and Type Field Description static intFACILITY_AUTHstatic intFACILITY_AUTHPRIVstatic intFACILITY_CRONstatic intFACILITY_DAEMONprotected static java.lang.String[]FACILITY_DESCRIPTIONSstatic intFACILITY_FTPstatic intFACILITY_KERNstatic intFACILITY_LOCAL0static intFACILITY_LOCAL1static intFACILITY_LOCAL2static intFACILITY_LOCAL3static intFACILITY_LOCAL4static intFACILITY_LOCAL5static intFACILITY_LOCAL6static intFACILITY_LOCAL7static intFACILITY_LPRstatic intFACILITY_MAILstatic intFACILITY_NEWSstatic intFACILITY_SYSLOGstatic intFACILITY_USERstatic intFACILITY_UUCPprivate intm_facilityprivate booleanm_showFacilityBannerstatic intPRIORITY_ALERTstatic intPRIORITY_CRITstatic intPRIORITY_DEBUGstatic intPRIORITY_EMERGstatic intPRIORITY_ERRstatic intPRIORITY_INFOstatic intPRIORITY_NOTICEstatic intPRIORITY_WARNING
-
Constructor Summary
Constructors Constructor Description SyslogFormatter()Constructor that assumes FACILITY_USER.SyslogFormatter(int facility)Constructor so that you can associate facility with formatter.SyslogFormatter(int facility, boolean showFacilityBanner)Constructor allowing setting of facility and whether to show banner.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Stringformat(LogEvent event)Format log event into syslog string.protected java.lang.StringgetFacilityDescription(int facility)Retrieve description for facility.protected intgetSyslogFacility(LogEvent event)Get facility associated with event.protected intgetSyslogPriority(LogEvent event)Get syslog priority code for LogEvent.
-
-
-
Field Detail
-
PRIORITY_DEBUG
public static final int PRIORITY_DEBUG
- See Also:
- Constant Field Values
-
PRIORITY_INFO
public static final int PRIORITY_INFO
- See Also:
- Constant Field Values
-
PRIORITY_NOTICE
public static final int PRIORITY_NOTICE
- See Also:
- Constant Field Values
-
PRIORITY_WARNING
public static final int PRIORITY_WARNING
- See Also:
- Constant Field Values
-
PRIORITY_ERR
public static final int PRIORITY_ERR
- See Also:
- Constant Field Values
-
PRIORITY_CRIT
public static final int PRIORITY_CRIT
- See Also:
- Constant Field Values
-
PRIORITY_ALERT
public static final int PRIORITY_ALERT
- See Also:
- Constant Field Values
-
PRIORITY_EMERG
public static final int PRIORITY_EMERG
- See Also:
- Constant Field Values
-
FACILITY_KERN
public static final int FACILITY_KERN
- See Also:
- Constant Field Values
-
FACILITY_USER
public static final int FACILITY_USER
- See Also:
- Constant Field Values
-
FACILITY_MAIL
public static final int FACILITY_MAIL
- See Also:
- Constant Field Values
-
FACILITY_DAEMON
public static final int FACILITY_DAEMON
- See Also:
- Constant Field Values
-
FACILITY_AUTH
public static final int FACILITY_AUTH
- See Also:
- Constant Field Values
-
FACILITY_SYSLOG
public static final int FACILITY_SYSLOG
- See Also:
- Constant Field Values
-
FACILITY_LPR
public static final int FACILITY_LPR
- See Also:
- Constant Field Values
-
FACILITY_NEWS
public static final int FACILITY_NEWS
- See Also:
- Constant Field Values
-
FACILITY_UUCP
public static final int FACILITY_UUCP
- See Also:
- Constant Field Values
-
FACILITY_CRON
public static final int FACILITY_CRON
- See Also:
- Constant Field Values
-
FACILITY_AUTHPRIV
public static final int FACILITY_AUTHPRIV
- See Also:
- Constant Field Values
-
FACILITY_FTP
public static final int FACILITY_FTP
- See Also:
- Constant Field Values
-
FACILITY_LOCAL0
public static final int FACILITY_LOCAL0
- See Also:
- Constant Field Values
-
FACILITY_LOCAL1
public static final int FACILITY_LOCAL1
- See Also:
- Constant Field Values
-
FACILITY_LOCAL2
public static final int FACILITY_LOCAL2
- See Also:
- Constant Field Values
-
FACILITY_LOCAL3
public static final int FACILITY_LOCAL3
- See Also:
- Constant Field Values
-
FACILITY_LOCAL4
public static final int FACILITY_LOCAL4
- See Also:
- Constant Field Values
-
FACILITY_LOCAL5
public static final int FACILITY_LOCAL5
- See Also:
- Constant Field Values
-
FACILITY_LOCAL6
public static final int FACILITY_LOCAL6
- See Also:
- Constant Field Values
-
FACILITY_LOCAL7
public static final int FACILITY_LOCAL7
- See Also:
- Constant Field Values
-
FACILITY_DESCRIPTIONS
protected static final java.lang.String[] FACILITY_DESCRIPTIONS
-
m_facility
private int m_facility
-
m_showFacilityBanner
private boolean m_showFacilityBanner
-
-
Constructor Detail
-
SyslogFormatter
public SyslogFormatter()
Constructor that assumes FACILITY_USER.
-
SyslogFormatter
public SyslogFormatter(int facility)
Constructor so that you can associate facility with formatter.- Parameters:
facility- the facility constant
-
SyslogFormatter
public SyslogFormatter(int facility, boolean showFacilityBanner)Constructor allowing setting of facility and whether to show banner.- Parameters:
facility- the facility code.showFacilityBanner- true if facility banner should be shown
-
-
Method Detail
-
format
public java.lang.String format(LogEvent event)
Format log event into syslog string.
-
getFacilityDescription
protected java.lang.String getFacilityDescription(int facility)
Retrieve description for facility.- Parameters:
facility- the facility code- Returns:
- the facility description
-
getSyslogFacility
protected int getSyslogFacility(LogEvent event)
Get facility associated with event. Default implementation returns facility set in constructor.- Parameters:
event- the log event- Returns:
- the facility code
-
getSyslogPriority
protected int getSyslogPriority(LogEvent event)
Get syslog priority code for LogEvent. This is done by translating LogKit priority to syslog priority.- Parameters:
event- the log event- Returns:
- the priority code
-
-