|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.productivity.java.syslog4j.Syslog
public final class Syslog
This class provides a Singleton interface for Syslog4j client implementations.
Usage examples:
Direct
Syslog.getInstance("udp").info("log message");
Via Instance
SyslogIF syslog = Syslog.getInstance("udp");
syslog.info();
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.
| Field Summary | |
|---|---|
protected static java.util.Map |
instances
|
| Method Summary | |
|---|---|
static SyslogIF |
createInstance(java.lang.String protocol,
SyslogConfigIF config)
Use createInstance(protocol,config) to create your own Syslog instance. |
static void |
destroyInstance(java.lang.String protocol)
destroyInstance() gracefully shuts down the specified Syslog protocol and removes the instance from Syslog4j. |
static void |
destroyInstance(SyslogIF syslog)
destroyInstance() gracefully shuts down the specified Syslog instance and removes it from Syslog4j. |
static boolean |
exists(java.lang.String protocol)
|
static SyslogIF |
getInstance(java.lang.String protocol)
Use getInstance(protocol) as the starting point for Syslog4j. |
static boolean |
getSuppressRuntimeExceptions()
|
static java.lang.String |
getVersion()
|
static void |
initialize()
initialize() sets up the default TCP and UDP Syslog protocols, as well as UNIX_SYSLOG and UNIX_SOCKET (if running on a Unix-based system). |
static void |
main(java.lang.String[] args)
|
static void |
setSuppressRuntimeExceptions(boolean suppress)
|
static void |
shutdown()
shutdown() gracefully shuts down all defined Syslog protocols, which includes flushing all queues and connections and finally clearing all instances (including those initialized by default). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final java.util.Map instances
| Method Detail |
|---|
public static final java.lang.String getVersion()
public static void setSuppressRuntimeExceptions(boolean suppress)
suppress - - true to suppress throwing SyslogRuntimeException in many methods of this class, false to throw exceptions (default)public static boolean getSuppressRuntimeExceptions()
public static final SyslogIF getInstance(java.lang.String protocol)
throws SyslogRuntimeException
protocol - - the Syslog protocol to use, e.g. "udp", "tcp", "unix_syslog", "unix_socket", or a custom protocol
SyslogRuntimeException
public static final SyslogIF createInstance(java.lang.String protocol,
SyslogConfigIF config)
throws SyslogRuntimeException
First, create an implementation of SyslogConfigIF, such as UdpNetSyslogConfig.
Second, configure that configuration instance.
Third, call createInstance(protocol,config) using a short & simple String for the protocol argument.
Fourth, either use the returned instance of SyslogIF, or in later code call getInstance(protocol) with the protocol chosen in the previous step.
protocol - config -
SyslogRuntimeExceptionpublic static final void initialize()
public static final boolean exists(java.lang.String protocol)
protocol - - Syslog protocol
public static final void shutdown()
public static final void destroyInstance(java.lang.String protocol)
throws SyslogRuntimeException
protocol - - the Syslog protocol to destroy
SyslogRuntimeException
public static final void destroyInstance(SyslogIF syslog)
throws SyslogRuntimeException
syslog - - the Syslog instance to destroy
SyslogRuntimeException
public static void main(java.lang.String[] args)
throws java.lang.Exception
java.lang.Exception
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||