Syslog White Paper FAQ Examples JavaDoc Classloader
Protomatter Software v1.1.7

com.protomatter.syslog
Class Syslog

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

public class Syslog
extends java.lang.Object

This class implements a system-wide logging utility. Please read the Syslog Whitepaper for more information. It allows a program to log messages and objects at different severity levels in a standardized way. The implementation of the log is specified by an object which implements the Syslogger interface. You can have multiple log implementations, and each can have it's own log mask or can inherit it's log mask from Syslog (this is the default behavior).

There are 5 severity levels: DEBUG, INFO, WARNING, ERROR, FATAL. They correspond to the numbers 0, 4, 8, 12, and 16, respectively. You can enable logging for any combination of these levels. The default setting logs only WARNING and above.

Quickie introduction and usage:
Anywhere you're doing this:
System.out.println("Some message");

Do this instead:

Syslog.debug(this, "Some message");

If you're in a static method, do this:

Syslog.debug(MyClass.class, "Some message");

If you like what this gets you, start playing around with different log levels (call "Syslog.info(...)" and others). If you like that, start playing around with channels and configuring the loggers and other things. Syslog has a very robust API and can be bent around to do all sorts of things, but it does not have to be complicated to use even though it can be configured in all sorts of complicated ways.

More involved usage examples:
 
   // log simple message at DEBUG level
   // pass 'this' as the object performing the logging
   Syslog.log(this, "simple message", null, Syslog.DEBUG);

// this performs toString() on object 'obj', and prints a message Syslog.log(this, "logging object", obj, Syslog.INFO);

// logs 'exception' and its stack trace at ERROR level Syslog.log(this, exception);

// here's how you log in a static method -- pass the class object Syslog.log(MyClass.class, "logging in MyClass");

// shortcuts for each log level Syslog.debug(this, "foo"); Syslog.debug(this, "foo", bar); Syslog.info(this, "foo"); Syslog.info(this, "foo", bar);

// log to multiple channels (the "foo" and "bar" channels) Syslog.infoToChannel(this, new String[]{"foo", "bar"}, "My message");

There are basically three types of methods on this class for issuing log messages. Whenever a channel name is not specified, the channel DEFAULT_CHANNEL is used.

Whenever a channel is specified, it is an Object. This argument can either be a String or an array of String (in which case, the message will be sent out to multiple channels).

When the Syslog class is loaded, the following happens:

  1. If the Syslog.level system property is set, it is passed to Syslog.setLogMask(...) (otherwise it defaults to WARNING).

  2. A PrintWriterLog named "PrintWriterLog.err" is added using Syslog.addLogger(...) and connected to the System.err PrintStream.

  3. If the Syslog.file system property is set, it is interpreted as a filename and another PrintWriterLog is added and connected to that file. The logger is named "PrintWriterLog.file".

If you want to change these defaults, you can use the getLoggers(), addLogger(...), removeLogger(...) and removeAllLoggers() methods to change what loggers are registered with Syslog.

Syslog provides background work queues for loggers that need to perform their operations asynchronously. For instance, the MailLog performs its policy check synchronously and then if it decides that a message will actually need to be sent, it asks syslog to perform the operation asynchronously. This is far more efficient than doing everything in the background because the amount of synchronization necessary to add work to a queue is usually larger than a policy check.

Please read the Syslog Whitepaper for more information on Syslog.

See Also:
Syslogger, SyslogChannelAware

Field Summary
static java.lang.String ALL_CHANNEL
          The symbolic name for all channels.
static Channel channel
          A log channel for syslog configuration and system related messages.
static int currentLogMask
          The current system-wide log mask.
static int DEBUG
          A log generated during debugging of the software.
static java.lang.String DEFAULT_CHANNEL
          The name of the default log channel.
static int ERROR
          One of the software components caused an error or exception.
static int FATAL
          One of the software components is no longer functional.
static int INFO
          An informational message that might come in handy later.
static int INHERIT_MASK
          Loggers can inherit Syslog's log mask by setting their log mask to this value.
static java.lang.String SYSLOG_CHANNEL_NAME
          The name of a log channel for syslog configuration and system related messages.
static int WARNING
          A warning message that the system administrator might want to know about.
static java.lang.String WARNING_PROPERTY
          Syslog classloader warning system property name.
 
Constructor Summary
protected Syslog()
          Protected constructor.
 
Method Summary
static void addLogger(Syslogger log)
          Registers a new Syslogger object with Syslog.
static void addWork(java.lang.String queueName, java.lang.Runnable r)
          Add work to the given background queue.
static int atOrAbove(int level)
           
static boolean canDebug()
          Determine if the current syslog mask would allow a message at the DEBUG level to be logged.
static boolean canDebug(java.lang.Object logger)
          Deprecated.  
static boolean canError()
          Determine if the current syslog mask would allow a message at the ERROR level to be logged.
static boolean canError(java.lang.Object logger)
          Deprecated.  
static boolean canFatal()
          Determine if the current syslog mask would allow a message at the FATAL level to be logged.
static boolean canFatal(java.lang.Object logger)
          Deprecated.  
static boolean canInfo()
          Determine if the current syslog mask would allow a message at the INFO level to be logged.
static boolean canInfo(java.lang.Object logger)
          Deprecated.  
static boolean canLog(int level)
          Determine if the current default syslog mask would allow the given level of message to be logged.
static boolean canLog(java.lang.Object logger, int level)
          Deprecated.  
static boolean canWarning()
          Determine if the current syslog mask would allow a message at the WARNING level to be logged.
static boolean canWarning(java.lang.Object logger)
          Deprecated.  
static void debug(java.net.InetAddress host, java.lang.Object logger, java.lang.Object message)
          Logs a debug message, which will be converted through toString().
static void debug(java.net.InetAddress host, java.lang.Object logger, java.lang.Object message, java.lang.Object detail)
          Logs a debug message with a detail object, both of which will be converted through toString().
static void debug(java.lang.Object logger, java.lang.Object message)
          Logs a debug message, which will be converted through toString().
static void debug(java.lang.Object logger, java.lang.Object message, java.lang.Object detail)
          Logs a debug message with a detail object, both of which will be converted through toString().
static void debugToChannel(java.net.InetAddress host, java.lang.Object logger, java.lang.Object channel, java.lang.Object message)
          Logs a debug message to the given channel.
static void debugToChannel(java.net.InetAddress host, java.lang.Object logger, java.lang.Object channel, java.lang.Object message, java.lang.Object detail)
          Logs a debug message with a detail object to the given channel.
static void debugToChannel(java.lang.Object logger, java.lang.Object channel, java.lang.Object message)
          Logs a debug message to the given channel.
static void debugToChannel(java.lang.Object logger, java.lang.Object channel, java.lang.Object message, java.lang.Object detail)
          Logs a debug message with a detail object to the given channel.
static void error(java.net.InetAddress host, java.lang.Object logger, java.lang.Object message)
          Logs a error message, which will be converted through toString().
static void error(java.net.InetAddress host, java.lang.Object logger, java.lang.Object message, java.lang.Object detail)
          Logs a error message with a detail object, both of which will be converted through toString().
static void error(java.lang.Object logger, java.lang.Object message)
          Logs a error message, which will be converted through toString().
static void error(java.lang.Object logger, java.lang.Object message, java.lang.Object detail)
          Logs a error message with a detail object, both of which will be converted through toString().
static void errorToChannel(java.net.InetAddress host, java.lang.Object logger, java.lang.Object channel, java.lang.Object message)
          Logs an error message to the given channel.
static void errorToChannel(java.net.InetAddress host, java.lang.Object logger, java.lang.Object channel, java.lang.Object message, java.lang.Object detail)
          Logs an error message with a detail object to the given channel.
static void errorToChannel(java.lang.Object logger, java.lang.Object channel, java.lang.Object message)
          Logs an error message to the given channel.
static void errorToChannel(java.lang.Object logger, java.lang.Object channel, java.lang.Object message, java.lang.Object detail)
          Logs an error message with a detail object to the given channel.
static void fatal(java.net.InetAddress host, java.lang.Object logger, java.lang.Object message)
          Logs a fatal message, which will be converted through toString().
static void fatal(java.net.InetAddress host, java.lang.Object logger, java.lang.Object message, java.lang.Object detail)
          Logs a fatal message with a detail object, both of which will be converted through toString().
static void fatal(java.lang.Object logger, java.lang.Object message)
          Logs a fatal message, which will be converted through toString().
static void fatal(java.lang.Object logger, java.lang.Object message, java.lang.Object detail)
          Logs a fatal message with a detail object, both of which will be converted through toString().
static void fatalToChannel(java.net.InetAddress host, java.lang.Object logger, java.lang.Object channel, java.lang.Object message)
          Logs a fatal message to the given channel.
static void fatalToChannel(java.net.InetAddress host, java.lang.Object logger, java.lang.Object channel, java.lang.Object message, java.lang.Object detail)
          Logs a fatal message with a detail object to the given channel.
static void fatalToChannel(java.lang.Object logger, java.lang.Object channel, java.lang.Object message)
          Logs a fatal message to the given channel.
static void fatalToChannel(java.lang.Object logger, java.lang.Object channel, java.lang.Object message, java.lang.Object detail)
          Logs a fatal message with a detail object to the given channel.
static void flush()
          Flush output to all loggers.
static long getFlushThreadInterval()
          Get the sleep interval of the logger flush thread.
static Syslog getInstance()
          Returns the global Syslog instance.
static java.net.InetAddress getLocalHostName()
          Get the local hostname.
static Syslogger getLogger(java.lang.String name)
          Get a logger by name.
static java.util.Iterator getLoggers()
          Returns an Enumeration of all Syslogger objects registered with Syslog.
static int getLogMask()
          Get the default mask for logging of messages.
static java.lang.String getLogMaskAsString()
          Get a string representation of the current master log mask.
static java.lang.String getLogMaskAsString(int logMask)
          Get a string representation of the given log mask.
static java.util.ResourceBundle getResources()
          Get the resource bundle associated with Syslog.
static java.lang.String getResourceString(java.lang.String name)
          Get the value of the given resource name associated with Syslog.
static java.util.Map getWorkQueueMap()
          Get a map of the background work queues.
static void info(java.net.InetAddress host, java.lang.Object logger, java.lang.Object message)
          Logs a info message, which will be converted through toString().
static void info(java.net.InetAddress host, java.lang.Object logger, java.lang.Object message, java.lang.Object detail)
          Logs a info message with a detail object, both of which will be converted through toString().
static void info(java.lang.Object logger, java.lang.Object message)
          Logs a info message, which will be converted through toString().
static void info(java.lang.Object logger, java.lang.Object message, java.lang.Object detail)
          Logs a info message with a detail object, both of which will be converted through toString().
static void infoToChannel(java.net.InetAddress host, java.lang.Object logger, java.lang.Object channel, java.lang.Object message)
          Logs an info message to the given channel.
static void infoToChannel(java.net.InetAddress host, java.lang.Object logger, java.lang.Object channel, java.lang.Object message, java.lang.Object detail)
          Logs an info message with a detail object to the given channel.
static void infoToChannel(java.lang.Object logger, java.lang.Object channel, java.lang.Object message)
          Logs an info message to the given channel.
static void infoToChannel(java.lang.Object logger, java.lang.Object channel, java.lang.Object message, java.lang.Object detail)
          Logs an info message with a detail object to the given channel.
static void log(java.net.InetAddress host, java.lang.Object logger, java.lang.Object msg, java.lang.Object detail, int level)
          Log a message.
static void log(java.net.InetAddress host, java.lang.Object logger, java.lang.Object channel, java.lang.Object msg, java.lang.Object detail, int level)
          Log a message.
static void log(java.net.InetAddress host, java.lang.Object logger, java.lang.Object channel, java.lang.Object msg, java.lang.Object detail, int level, java.lang.Thread thread, java.lang.String threadName, long messageSendTime)
          Log a message.
static void log(java.net.InetAddress host, java.lang.Object logger, java.lang.Throwable e)
          Logs an exception for the given object.
static void log(java.net.InetAddress host, java.lang.Object logger, java.lang.Throwable e, int level)
          Logs an exception for the given object at a given level.
static void log(java.lang.Object logger, java.lang.Object msg, java.lang.Object detail, int level)
          Log a message.
static void log(java.lang.Object logger, java.lang.Object channel, java.lang.Object msg, java.lang.Object detail, int level)
          Log a message.
static void log(java.lang.Object logger, java.lang.Throwable e)
          Logs an exception for the given object.
static void log(java.lang.Object logger, java.lang.Throwable e, int level)
          Logs an exception for the given object at a given level.
static boolean mightDebug(java.lang.Object logger)
          Determine if it's likely that someone will listen to a debug message from the given logger.
static boolean mightDebug(java.lang.Object logger, java.lang.Object channel)
          Determine if it's likely that someone will listen to a debug message from the given logger on the given channel(s).
static boolean mightError(java.lang.Object logger)
          Determine if it's likely that someone will listen to an error message from the given logger.
static boolean mightError(java.lang.Object logger, java.lang.Object channel)
          Determine if it's likely that someone will listen to an error message from the given logger on the given channel(s).
static boolean mightFatal(java.lang.Object logger)
          Determine if it's likely that someone will listen to a fatal message from the given logger.
static boolean mightFatal(java.lang.Object logger, java.lang.Object channel)
          Determine if it's likely that someone will listen to a fatal message from the given logger on the given channel(s).
static boolean mightInfo(java.lang.Object logger)
          Determine if it's likely that someone will listen to an info message from the given logger.
static boolean mightInfo(java.lang.Object logger, java.lang.Object channel)
          Determine if it's likely that someone will listen to an info message from the given logger on the given channel(s).
static boolean mightLog(java.lang.Object logger, int level)
          Determine if it's likely that someone will listen to a message from the given logger at the given level.
static boolean mightLog(java.lang.Object logger, int level, java.lang.Object channel)
          Determine if it's likely that someone will listen to a message from the given logger at the given level on the given channel(s).
static boolean mightWarning(java.lang.Object logger)
          Determine if it's likely that someone will listen to a warning message from the given logger.
static boolean mightWarning(java.lang.Object logger, java.lang.Object channel)
          Determine if it's likely that someone will listen to a warning message from the given logger on the given channel(s).
static int parseLogMask(java.lang.String mask)
          Parse the mask.
static void removeAllLoggers()
          Deregisters all Syslogger objects.
static boolean removeLogger(Syslogger log)
          Deregisters a Syslogger object from Syslog.
static void setFlushThreadInterval(long interval)
          Set the number of milliseconds a flush thread should wait before flushing output on each logger.
static void setLocalHostName()
          Set the local hostname automatically.
static void setLocalHostName(java.net.InetAddress host)
          Set the local hostname.
static void setLogMask(int mask)
          Set the default mask for logging of messages.
static void setLogMask(java.lang.String mask)
          Set the mask.
static void setMasterSwitch(boolean value)
          Set the value of the master switch.
static void shutdown()
          Remove all the loggers and shut them down.
static void warning(java.net.InetAddress host, java.lang.Object logger, java.lang.Object message)
          Logs a warning message, which will be converted through toString().
static void warning(java.net.InetAddress host, java.lang.Object logger, java.lang.Object message, java.lang.Object detail)
          Logs a warning message with a detail object, both of which will be converted through toString().
static void warning(java.lang.Object logger, java.lang.Object message)
          Logs a warning message, which will be converted through toString().
static void warning(java.lang.Object logger, java.lang.Object message, java.lang.Object detail)
          Logs a warning message with a detail object, both of which will be converted through toString().
static void warningToChannel(java.net.InetAddress host, java.lang.Object logger, java.lang.Object channel, java.lang.Object message)
          Logs a warning message to the given channel.
static void warningToChannel(java.net.InetAddress host, java.lang.Object logger, java.lang.Object channel, java.lang.Object message, java.lang.Object detail)
          Logs a warning message with a detail object to the given channel.
static void warningToChannel(java.lang.Object logger, java.lang.Object channel, java.lang.Object message)
          Logs a warning message to the given channel.
static void warningToChannel(java.lang.Object logger, java.lang.Object channel, java.lang.Object message, java.lang.Object detail)
          Logs a warning message with a detail object to the given channel.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

public static final int DEBUG
A log generated during debugging of the software.

INFO

public static final int INFO
An informational message that might come in handy later.

WARNING

public static final int WARNING
A warning message that the system administrator might want to know about.

ERROR

public static final int ERROR
One of the software components caused an error or exception.

FATAL

public static final int FATAL
One of the software components is no longer functional.

INHERIT_MASK

public static final int INHERIT_MASK
Loggers can inherit Syslog's log mask by setting their log mask to this value.

DEFAULT_CHANNEL

public static final java.lang.String DEFAULT_CHANNEL
The name of the default log channel.

ALL_CHANNEL

public static final java.lang.String ALL_CHANNEL
The symbolic name for all channels.

currentLogMask

public static int currentLogMask
The current system-wide log mask. This variable is exposed so that policies that inherit their mask from Syslog can get the value faster than by calling a method.

SYSLOG_CHANNEL_NAME

public static java.lang.String SYSLOG_CHANNEL_NAME
The name of a log channel for syslog configuration and system related messages.

channel

public static Channel channel
A log channel for syslog configuration and system related messages.

WARNING_PROPERTY

public static final java.lang.String WARNING_PROPERTY
Syslog classloader warning system property name.
Constructor Detail

Syslog

protected Syslog()
Protected constructor. Please don't make a subclass of Syslog unless you really know what you're doing.
Method Detail

getInstance

public static Syslog getInstance()
Returns the global Syslog instance. You really should not need to get ahold of it, as all the methods are static. You might want to get it so that you can keep an instance around to keep the class from being unloaded if you're writing application servers.

getWorkQueueMap

public static java.util.Map getWorkQueueMap()
Get a map of the background work queues. The key to the map is the name of the queue, and the value is a com.protomatter.util.WorkQueue object. You should never play with the queues -- this method is provided so that external processes can monitor the size of each queue by calling the getObjectPoolSize() method on each queue. The map itself is read-only.

getLocalHostName

public static java.net.InetAddress getLocalHostName()
Get the local hostname.

setFlushThreadInterval

public static void setFlushThreadInterval(long interval)
Set the number of milliseconds a flush thread should wait before flushing output on each logger. If the interval is 0 (or negative) the thread will be stopped. The default is not to have a flush thread running. You cannot set it to less than 1000ms, except for setting it to 0.

getFlushThreadInterval

public static long getFlushThreadInterval()
Get the sleep interval of the logger flush thread. This method will either return the number of milliseconds between flush calls, or zero if there is no flush thread running.

setLocalHostName

public static void setLocalHostName()
Set the local hostname automatically. This sets the hostname to whatever InetAddress.getLocalHost() returns. This is called by SimpleSyslogTextFormatter when it is configured if it is supposed to log the host name.

setLocalHostName

public static void setLocalHostName(java.net.InetAddress host)
Set the local hostname.

setMasterSwitch

public static void setMasterSwitch(boolean value)
Set the value of the master switch. If this switch is set to false, then all log requests will be ignored.

addWork

public static void addWork(java.lang.String queueName,
                           java.lang.Runnable r)
Add work to the given background queue. Queues are created (but not destroyed) dynamically.

addLogger

public static final void addLogger(Syslogger log)
Registers a new Syslogger object with Syslog.

removeLogger

public static final boolean removeLogger(Syslogger log)
Deregisters a Syslogger object from Syslog.

removeAllLoggers

public static final void removeAllLoggers()
Deregisters all Syslogger objects.

getLoggers

public static final java.util.Iterator getLoggers()
Returns an Enumeration of all Syslogger objects registered with Syslog.

shutdown

public static void shutdown()
Remove all the loggers and shut them down. Waits for all background queues to finish processing work. Any new messages received immediately after this method is called (before it completes) will be ignored.

getLogger

public static final Syslogger getLogger(java.lang.String name)
Get a logger by name. If there are multiple loggers with the same name, the first one registered with that name will be returned. If there is no logger by that name, null is returned.

setLogMask

public static final void setLogMask(int mask)
Set the default mask for logging of messages. For example, to log all messages of type ERROR or greater, you would: Syslog.setLogMask(Syslog.atOrAbove(ERROR));

setLogMask

public static final void setLogMask(java.lang.String mask)
Set the mask.
See Also:
parseLogMask(java.lang.String)

parseLogMask

public static final int parseLogMask(java.lang.String mask)
Parse the mask. If the value passed in is the name of a level, like "INFO" or "WARNING" the mask will be set to at or above the listed level. If the string passed in is "INHERIT_MASK" then this policy will inherit the mask set in Syslog itself.

You can also pass in a list of levels, separated by commas and with an "=" before each level to select non-contiguous groups of levels. For instance, passing in "=INFO,=ERROR" will catch messages only at the INFO and ERROR levels, and NOTHING ELSE.


getLogMaskAsString

public static java.lang.String getLogMaskAsString()
Get a string representation of the current master log mask.

getLogMaskAsString

public static java.lang.String getLogMaskAsString(int logMask)
Get a string representation of the given log mask.

getLogMask

public static final int getLogMask()
Get the default mask for logging of messages.

atOrAbove

public static final int atOrAbove(int level)
Returns:
the log mask for "all logs at or above this level"

log

public static final void log(java.net.InetAddress host,
                             java.lang.Object logger,
                             java.lang.Object msg,
                             java.lang.Object detail,
                             int level)
Log a message. Logs to the DEFAULT_CHANNEL channel.
Parameters:
host - The machine the log entry originated on.
logger - The object which is perfoming the log. It's class name will be extracted and added to the log.
msg - A short message describing the log entry.
detail - A longer message with more information (can be null).
level - The level of the log entry.

log

public static final void log(java.lang.Object logger,
                             java.lang.Object msg,
                             java.lang.Object detail,
                             int level)
Log a message. Logs to the DEFAULT_CHANNEL channel.
Parameters:
logger - The object which is perfoming the log. It's class name will be extracted and added to the log.
msg - A short message describing the log entry.
detail - A longer message with more information (can be null).
level - The level of the log entry.

log

public static final void log(java.lang.Object logger,
                             java.lang.Object channel,
                             java.lang.Object msg,
                             java.lang.Object detail,
                             int level)
Log a message. If detail is a subclass of Throwable it's stack trace will be included in the output. If you want to log to a channel other than DEFAULT_CHANNEL you will have to use this method or one of the xxxToChannel(...) methods.
Parameters:
logger - The object which is perfoming the log. It's class name will be extracted and added to the log.
channel - The log channel to write to.
msg - A short message describing the log entry.
detail - A longer message with more information (can be null).
level - The level of the log entry.

log

public static final void log(java.net.InetAddress host,
                             java.lang.Object logger,
                             java.lang.Object channel,
                             java.lang.Object msg,
                             java.lang.Object detail,
                             int level)
Log a message. If detail is a subclass of Throwable it's stack trace will be included in the output. If you want to log to a channel other than DEFAULT_CHANNEL you will have to use this method or one of the xxxToChannel(...) methods.
Parameters:
host - The host the log message originated on.
logger - The object which is perfoming the log. It's class name will be extracted and added to the log.
channel - The log channel to write to.
msg - A short message describing the log entry.
detail - A longer message with more information (can be null).
level - The level of the log entry.

log

public static final void log(java.net.InetAddress host,
                             java.lang.Object logger,
                             java.lang.Object channel,
                             java.lang.Object msg,
                             java.lang.Object detail,
                             int level,
                             java.lang.Thread thread,
                             java.lang.String threadName,
                             long messageSendTime)
Log a message. This method should not be called unless it's by a remote log adapter.
Parameters:
host - The host the log message originated on.
logger - The object which is perfoming the log. It's class name will be extracted and added to the log.
channel - The log channel to write to.
msg - A short message describing the log entry.
detail - A longer message with more information (can be null).
level - The level of the log entry.
thread - The thread making the log call (null if remote)
threadName - The name of the thread making the log call.
messageSendTime - The time the message was sent.

log

public static final void log(java.net.InetAddress host,
                             java.lang.Object logger,
                             java.lang.Throwable e)
Logs an exception for the given object. The log level will be ERROR.

log

public static final void log(java.net.InetAddress host,
                             java.lang.Object logger,
                             java.lang.Throwable e,
                             int level)
Logs an exception for the given object at a given level.

log

public static final void log(java.lang.Object logger,
                             java.lang.Throwable e)
Logs an exception for the given object. The log level will be ERROR.

log

public static final void log(java.lang.Object logger,
                             java.lang.Throwable e,
                             int level)
Logs an exception for the given object at a given level.

debug

public static final void debug(java.net.InetAddress host,
                               java.lang.Object logger,
                               java.lang.Object message)
Logs a debug message, which will be converted through toString().

debug

public static final void debug(java.net.InetAddress host,
                               java.lang.Object logger,
                               java.lang.Object message,
                               java.lang.Object detail)
Logs a debug message with a detail object, both of which will be converted through toString().

debugToChannel

public static final void debugToChannel(java.net.InetAddress host,
                                        java.lang.Object logger,
                                        java.lang.Object channel,
                                        java.lang.Object message)
Logs a debug message to the given channel.

debugToChannel

public static final void debugToChannel(java.net.InetAddress host,
                                        java.lang.Object logger,
                                        java.lang.Object channel,
                                        java.lang.Object message,
                                        java.lang.Object detail)
Logs a debug message with a detail object to the given channel.

debug

public static final void debug(java.lang.Object logger,
                               java.lang.Object message)
Logs a debug message, which will be converted through toString().

debug

public static final void debug(java.lang.Object logger,
                               java.lang.Object message,
                               java.lang.Object detail)
Logs a debug message with a detail object, both of which will be converted through toString().

debugToChannel

public static final void debugToChannel(java.lang.Object logger,
                                        java.lang.Object channel,
                                        java.lang.Object message)
Logs a debug message to the given channel.

debugToChannel

public static final void debugToChannel(java.lang.Object logger,
                                        java.lang.Object channel,
                                        java.lang.Object message,
                                        java.lang.Object detail)
Logs a debug message with a detail object to the given channel.

info

public static final void info(java.net.InetAddress host,
                              java.lang.Object logger,
                              java.lang.Object message)
Logs a info message, which will be converted through toString().

info

public static final void info(java.net.InetAddress host,
                              java.lang.Object logger,
                              java.lang.Object message,
                              java.lang.Object detail)
Logs a info message with a detail object, both of which will be converted through toString().

infoToChannel

public static final void infoToChannel(java.net.InetAddress host,
                                       java.lang.Object logger,
                                       java.lang.Object channel,
                                       java.lang.Object message)
Logs an info message to the given channel.

infoToChannel

public static final void infoToChannel(java.net.InetAddress host,
                                       java.lang.Object logger,
                                       java.lang.Object channel,
                                       java.lang.Object message,
                                       java.lang.Object detail)
Logs an info message with a detail object to the given channel.

info

public static final void info(java.lang.Object logger,
                              java.lang.Object message)
Logs a info message, which will be converted through toString().

info

public static final void info(java.lang.Object logger,
                              java.lang.Object message,
                              java.lang.Object detail)
Logs a info message with a detail object, both of which will be converted through toString().

infoToChannel

public static final void infoToChannel(java.lang.Object logger,
                                       java.lang.Object channel,
                                       java.lang.Object message)
Logs an info message to the given channel.

infoToChannel

public static final void infoToChannel(java.lang.Object logger,
                                       java.lang.Object channel,
                                       java.lang.Object message,
                                       java.lang.Object detail)
Logs an info message with a detail object to the given channel.

warning

public static final void warning(java.net.InetAddress host,
                                 java.lang.Object logger,
                                 java.lang.Object message)
Logs a warning message, which will be converted through toString().

warning

public static final void warning(java.net.InetAddress host,
                                 java.lang.Object logger,
                                 java.lang.Object message,
                                 java.lang.Object detail)
Logs a warning message with a detail object, both of which will be converted through toString().

warningToChannel

public static final void warningToChannel(java.net.InetAddress host,
                                          java.lang.Object logger,
                                          java.lang.Object channel,
                                          java.lang.Object message)
Logs a warning message to the given channel.

warningToChannel

public static final void warningToChannel(java.net.InetAddress host,
                                          java.lang.Object logger,
                                          java.lang.Object channel,
                                          java.lang.Object message,
                                          java.lang.Object detail)
Logs a warning message with a detail object to the given channel.

warning

public static final void warning(java.lang.Object logger,
                                 java.lang.Object message)
Logs a warning message, which will be converted through toString().

warning

public static final void warning(java.lang.Object logger,
                                 java.lang.Object message,
                                 java.lang.Object detail)
Logs a warning message with a detail object, both of which will be converted through toString().

warningToChannel

public static final void warningToChannel(java.lang.Object logger,
                                          java.lang.Object channel,
                                          java.lang.Object message)
Logs a warning message to the given channel.

warningToChannel

public static final void warningToChannel(java.lang.Object logger,
                                          java.lang.Object channel,
                                          java.lang.Object message,
                                          java.lang.Object detail)
Logs a warning message with a detail object to the given channel.

error

public static final void error(java.net.InetAddress host,
                               java.lang.Object logger,
                               java.lang.Object message)
Logs a error message, which will be converted through toString().

error

public static final void error(java.net.InetAddress host,
                               java.lang.Object logger,
                               java.lang.Object message,
                               java.lang.Object detail)
Logs a error message with a detail object, both of which will be converted through toString().

errorToChannel

public static final void errorToChannel(java.net.InetAddress host,
                                        java.lang.Object logger,
                                        java.lang.Object channel,
                                        java.lang.Object message)
Logs an error message to the given channel.

errorToChannel

public static final void errorToChannel(java.net.InetAddress host,
                                        java.lang.Object logger,
                                        java.lang.Object channel,
                                        java.lang.Object message,
                                        java.lang.Object detail)
Logs an error message with a detail object to the given channel.

error

public static final void error(java.lang.Object logger,
                               java.lang.Object message)
Logs a error message, which will be converted through toString().

error

public static final void error(java.lang.Object logger,
                               java.lang.Object message,
                               java.lang.Object detail)
Logs a error message with a detail object, both of which will be converted through toString().

errorToChannel

public static final void errorToChannel(java.lang.Object logger,
                                        java.lang.Object channel,
                                        java.lang.Object message)
Logs an error message to the given channel.

errorToChannel

public static final void errorToChannel(java.lang.Object logger,
                                        java.lang.Object channel,
                                        java.lang.Object message,
                                        java.lang.Object detail)
Logs an error message with a detail object to the given channel.

fatal

public static final void fatal(java.net.InetAddress host,
                               java.lang.Object logger,
                               java.lang.Object message)
Logs a fatal message, which will be converted through toString().

fatal

public static final void fatal(java.net.InetAddress host,
                               java.lang.Object logger,
                               java.lang.Object message,
                               java.lang.Object detail)
Logs a fatal message with a detail object, both of which will be converted through toString().

fatalToChannel

public static final void fatalToChannel(java.net.InetAddress host,
                                        java.lang.Object logger,
                                        java.lang.Object channel,
                                        java.lang.Object message)
Logs a fatal message to the given channel.

fatalToChannel

public static final void fatalToChannel(java.net.InetAddress host,
                                        java.lang.Object logger,
                                        java.lang.Object channel,
                                        java.lang.Object message,
                                        java.lang.Object detail)
Logs a fatal message with a detail object to the given channel.

fatal

public static final void fatal(java.lang.Object logger,
                               java.lang.Object message)
Logs a fatal message, which will be converted through toString().

fatal

public static final void fatal(java.lang.Object logger,
                               java.lang.Object message,
                               java.lang.Object detail)
Logs a fatal message with a detail object, both of which will be converted through toString().

fatalToChannel

public static final void fatalToChannel(java.lang.Object logger,
                                        java.lang.Object channel,
                                        java.lang.Object message)
Logs a fatal message to the given channel.

fatalToChannel

public static final void fatalToChannel(java.lang.Object logger,
                                        java.lang.Object channel,
                                        java.lang.Object message,
                                        java.lang.Object detail)
Logs a fatal message with a detail object to the given channel.

canLog

public static final boolean canLog(int level)
Determine if the current default syslog mask would allow the given level of message to be logged. This is not an absolute method of determining if a message would be logged by some registered logger. If there is a registered logger who is not inheriting the mask from Syslog itself, it may (or may not) have logged the message.

canDebug

public static final boolean canDebug()
Determine if the current syslog mask would allow a message at the DEBUG level to be logged.
See Also:
canLog(int)

canInfo

public static final boolean canInfo()
Determine if the current syslog mask would allow a message at the INFO level to be logged.
See Also:
canLog(int)

canWarning

public static final boolean canWarning()
Determine if the current syslog mask would allow a message at the WARNING level to be logged.
See Also:
canLog(int)

canError

public static final boolean canError()
Determine if the current syslog mask would allow a message at the ERROR level to be logged.
See Also:
canLog(int)

canFatal

public static final boolean canFatal()
Determine if the current syslog mask would allow a message at the FATAL level to be logged.
See Also:
canLog(int)

mightLog

public static final boolean mightLog(java.lang.Object logger,
                                     int level)
Determine if it's likely that someone will listen to a message from the given logger at the given level.
See Also:
mightLog(Object, int, Object)

mightDebug

public static final boolean mightDebug(java.lang.Object logger)
Determine if it's likely that someone will listen to a debug message from the given logger.
See Also:
mightLog(Object, int, Object)

mightInfo

public static final boolean mightInfo(java.lang.Object logger)
Determine if it's likely that someone will listen to an info message from the given logger.
See Also:
mightLog(Object, int, Object)

mightWarning

public static final boolean mightWarning(java.lang.Object logger)
Determine if it's likely that someone will listen to a warning message from the given logger.
See Also:
mightLog(Object, int, Object)

mightError

public static final boolean mightError(java.lang.Object logger)
Determine if it's likely that someone will listen to an error message from the given logger.
See Also:
mightLog(Object, int, Object)

mightFatal

public static final boolean mightFatal(java.lang.Object logger)
Determine if it's likely that someone will listen to a fatal message from the given logger.
See Also:
mightLog(Object, int, Object)

mightDebug

public static final boolean mightDebug(java.lang.Object logger,
                                       java.lang.Object channel)
Determine if it's likely that someone will listen to a debug message from the given logger on the given channel(s).
See Also:
mightLog(Object, int, Object)

mightInfo

public static final boolean mightInfo(java.lang.Object logger,
                                      java.lang.Object channel)
Determine if it's likely that someone will listen to an info message from the given logger on the given channel(s).
See Also:
mightLog(Object, int, Object)

mightWarning

public static final boolean mightWarning(java.lang.Object logger,
                                         java.lang.Object channel)
Determine if it's likely that someone will listen to a warning message from the given logger on the given channel(s).
See Also:
mightLog(Object, int, Object)

mightError

public static final boolean mightError(java.lang.Object logger,
                                       java.lang.Object channel)
Determine if it's likely that someone will listen to an error message from the given logger on the given channel(s).
See Also:
mightLog(Object, int, Object)

mightFatal

public static final boolean mightFatal(java.lang.Object logger,
                                       java.lang.Object channel)
Determine if it's likely that someone will listen to a fatal message from the given logger on the given channel(s).
See Also:
mightLog(Object, int, Object)

mightLog

public static final boolean mightLog(java.lang.Object logger,
                                     int level,
                                     java.lang.Object channel)
Determine if it's likely that someone will listen to a message from the given logger at the given level on the given channel(s). This basically asks each logger if it would probably log a message from the given logger at the given level on the given channel(s). Since it's possible that a logger's policy might take something else into account when determining if a message is to be logged, this method may not be 100% accurate, but it should cover about 90% of the situations where programmers want to see if someone's listening before they send a big, fat message down the pipe to Syslog.

Using the SimpleLogPolicy policy configured differently on five loggers and running JDK 1.2.2 on a RedHat 6.1 machine (PIII 550MHz, 512MB memory) it took between 50 and 200 milliseconds to call this method 1,000 times (between 0.2 and 0.05 milliseconds for each method call). Programmers writing custom log policies should take note that their implementation of the shouldLog() method must execute very quickly. If you're using the default policy, speed should not be an issue.


canLog

public static final boolean canLog(java.lang.Object logger,
                                   int level)
Deprecated.  

Pass-through to mightLog(Object logger, int level).
See Also:
mightLog(Object, int)

canDebug

public static final boolean canDebug(java.lang.Object logger)
Deprecated.  

Pass-through to mightDebug(Object logger).
See Also:
mightDebug(Object)

canInfo

public static final boolean canInfo(java.lang.Object logger)
Deprecated.  

Pass-through to mightInfo(Object logger).
See Also:
mightInfo(Object)

canWarning

public static final boolean canWarning(java.lang.Object logger)
Deprecated.  

Pass-through to mightWarning(Object logger).
See Also:
mightWarning(Object)

canError

public static final boolean canError(java.lang.Object logger)
Deprecated.  

Pass-through to mightError(Object logger).
See Also:
mightError(Object)

canFatal

public static final boolean canFatal(java.lang.Object logger)
Deprecated.  

Pass-through to mightFatal(Object logger).
See Also:
mightFatal(Object)

flush

public static void flush()
Flush output to all loggers.

getResources

public static final java.util.ResourceBundle getResources()
Get the resource bundle associated with Syslog.

getResourceString

public static final java.lang.String getResourceString(java.lang.String name)
Get the value of the given resource name associated with Syslog.

Protomatter Software v1.1.7
Copyright 1998-2002 Nate Sammons

Protomatter Software v1.1.7 http://protomatter.sourceforge.net/1.1.7