com.ice.syslog
Class Syslog

java.lang.Object
  |
  +--com.ice.syslog.Syslog

public class Syslog
extends java.lang.Object

The Syslog class implements the UNIX syslog protocol allowing Java to log messages to a specified UNIX host. Care has been taken to preserve as much of the UNIX implementation as possible.
To use Syslog, simply create an instance, and use the Syslog() method to log your message. The class provides all the expected syslog constants. For example, LOG_ERR is Syslog.LOG_ERR.
Written: Tim Endres
Version: 1.2 - July 27, 1998
Version: 1.0 - August 14, 1996
Source: Syslog.java

See Also:
DatagramSocket, InetAddress

Constructor Summary
Syslog(java.lang.String name, int flags)
          Creates a Syslog object instance, targeted for the UNIX host with the hostname 'hostname' on the syslog port 'port'.
Syslog(java.lang.String hostname, int port, java.lang.String name, int flags)
          Creates a Syslog object instance, targeted for the UNIX host with the hostname 'hostname' on the syslog port 'port'.
 
Method Summary
static void close()
          Unbinds the current syslog host.
static void log(int fac, int lvl, java.lang.String msg)
          Performs a syslog to the currently bound syslog host.
static void open(java.lang.String hostname, java.lang.String name, int flags)
          Binds the Syslog class to a specified host for further logging.
 void syslog(java.net.InetAddress addr, int port, int fac, int pri, java.lang.String msg)
          Use this method to log your syslog messages.
 void syslog(java.net.InetAddress addr, int fac, int pri, java.lang.String msg)
          Use this method to log your syslog messages.
 void syslog(int fac, int pri, java.lang.String msg)
          Use this method to log your syslog messages.
 void syslog(java.lang.String hostname, int port, int fac, int pri, java.lang.String msg)
          Use this method to log your syslog messages.
 void syslog(java.lang.String hostname, int fac, int pri, java.lang.String msg)
          Use this method to log your syslog messages.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Syslog

public Syslog(java.lang.String name,
              int flags)
       throws SyslogException
Creates a Syslog object instance, targeted for the UNIX host with the hostname 'hostname' on the syslog port 'port'. The only flags recognized are 'LOG_PERROR', which will log the message to Java's 'System.err'.


Syslog

public Syslog(java.lang.String hostname,
              int port,
              java.lang.String name,
              int flags)
       throws SyslogException
Creates a Syslog object instance, targeted for the UNIX host with the hostname 'hostname' on the syslog port 'port'. The only flags recognized are 'LOG_PERROR', which will log the message to Java's 'System.err'.

Method Detail

open

public static void open(java.lang.String hostname,
                        java.lang.String name,
                        int flags)
                 throws SyslogException
Binds the Syslog class to a specified host for further logging. See the Syslog constructor for details on the parameters.

SyslogException

log

public static void log(int fac,
                       int lvl,
                       java.lang.String msg)
                throws SyslogException
Performs a syslog to the currently bound syslog host.

SyslogException

close

public static void close()
Unbinds the current syslog host.


syslog

public void syslog(int fac,
                   int pri,
                   java.lang.String msg)
            throws SyslogException
Use this method to log your syslog messages. The facility and level are the same as their UNIX counterparts, and the Syslog class provides constants for these fields. The msg is what is actually logged.

SyslogException

syslog

public void syslog(java.net.InetAddress addr,
                   int fac,
                   int pri,
                   java.lang.String msg)
            throws SyslogException
Use this method to log your syslog messages. The facility and level are the same as their UNIX counterparts, and the Syslog class provides constants for these fields. The msg is what is actually logged.

SyslogException

syslog

public void syslog(java.lang.String hostname,
                   int fac,
                   int pri,
                   java.lang.String msg)
            throws SyslogException
Use this method to log your syslog messages. The facility and level are the same as their UNIX counterparts, and the Syslog class provides constants for these fields. The msg is what is actually logged.

SyslogException

syslog

public void syslog(java.lang.String hostname,
                   int port,
                   int fac,
                   int pri,
                   java.lang.String msg)
            throws SyslogException
Use this method to log your syslog messages. The facility and level are the same as their UNIX counterparts, and the Syslog class provides constants for these fields. The msg is what is actually logged.

SyslogException

syslog

public void syslog(java.net.InetAddress addr,
                   int port,
                   int fac,
                   int pri,
                   java.lang.String msg)
            throws SyslogException
Use this method to log your syslog messages. The facility and level are the same as their UNIX counterparts, and the Syslog class provides constants for these fields. The msg is what is actually logged.

SyslogException