Main: Whitepaper FAQ Examples JavaDoc Classloader Performance
Protomatter Software v1.1.8

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).

You may want to look at the Channel class. Some people prefet its API.

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.

Author:
nate
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 com.protomatter.util.Debug debugging
           
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()
          Deprecated.  
static boolean canDebug(java.lang.Object logger)
          Deprecated.  
static boolean canError()
          Deprecated.  
static boolean canError(java.lang.Object logger)
          Deprecated.  
static boolean canFatal()
          Deprecated.  
static boolean canFatal(java.lang.Object logger)
          Deprecated.  
static boolean canInfo()
          Deprecated.  
static boolean canInfo(java.lang.Object logger)
          Deprecated.  
static boolean canLog(int level)
          Deprecated.  
static boolean canLog(java.lang.Object logger, int level)
          Deprecated.  
static boolean canWarning()
          Deprecated.  
static boolean canWarning(java.lang.Object logger)
          Deprecated.  
static void crumb()
          Logs a breadcrumb at the debug level.
static void crumb(java.lang.Object logger)
          Logs a breadcrumb at the debug level.
static void crumb(java.lang.Object logger, java.lang.Object channel)
          Logs a breadcrumb at the debug level.
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 boolean getAlwaysComputeCaller()
          Get the flag for always computing calling class and method names at runtime.
static boolean getComputeCaller()
          Get the flag for computing calling class and method names at runtime.
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 boolean inMask(int level, int mask)
          Check if the given level is covered by the given mask.
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 incomingChannel, 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.Object incomingChannel, java.lang.Object msg, java.lang.Object detail, int level, java.lang.Thread thread, java.lang.String threadName, long messageSendTime, int traceDepth)
          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)
          Deprecated.  
static boolean mightDebug(java.lang.Object logger, java.lang.Object channel)
          Deprecated.  
static boolean mightError(java.lang.Object logger)
          Deprecated.  
static boolean mightError(java.lang.Object logger, java.lang.Object channel)
          Deprecated.  
static boolean mightFatal(java.lang.Object logger)
          Deprecated.  
static boolean mightFatal(java.lang.Object logger, java.lang.Object channel)
          Deprecated.  
static boolean mightInfo(java.lang.Object logger)
          Deprecated.  
static boolean mightInfo(java.lang.Object logger, java.lang.Object channel)
          Deprecated.  
static boolean mightLog(java.lang.Object logger, int level)
          Deprecated.  
static boolean mightLog(java.lang.Object logger, int level, java.lang.Object channel)
          Deprecated.  
static boolean mightWarning(java.lang.Object logger)
          Deprecated.  
static boolean mightWarning(java.lang.Object logger, java.lang.Object channel)
          Deprecated.  
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 setAlwaysComputeCaller(boolean setting)
          Set the flag for always computing calling class and method names at runtime.
static void setComputeCaller(boolean setting)
          Set the flag for computing calling class and method names at runtime.
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

debugging

public static final com.protomatter.util.Debug debugging

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.
Returns:
The instance value

setComputeCaller

public static void setComputeCaller(boolean setting)
Set the flag for computing calling class and method names at runtime. Default is false.

getComputeCaller

public static boolean getComputeCaller()
Get the flag for computing calling class and method names at runtime. Default is false.

setAlwaysComputeCaller

public static void setAlwaysComputeCaller(boolean setting)
Set the flag for always computing calling class and method names at runtime. Default is false.

getAlwaysComputeCaller

public static boolean getAlwaysComputeCaller()
Get the flag for always computing calling class and method names at runtime. Default is false. If this is set to true then the correct method name and caller are always computed so they are available to the log policies. This can be overly expensive if you have lots of debug statements. If this flag is set to false then the caller class and method are only computed if the log call passes the policy check, and if the getComputeCallingClassAndMethod() flag is also set to true.

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.
Returns:
The workQueueMap value

getLocalHostName

public static java.net.InetAddress getLocalHostName()
Get the local hostname.
Returns:
The localHostName value

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.
Parameters:
interval - The new flushThreadInterval value

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.
Returns:
The flushThreadInterval value

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.
Parameters:
host - The new localHostName value

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.
Parameters:
value - The new masterSwitch value

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.
Parameters:
queueName - The feature to be added to the Work attribute
r - The feature to be added to the Work attribute

addLogger

public static final void addLogger(Syslogger log)
Registers a new Syslogger object with Syslog.
Parameters:
log - The feature to be added to the Logger attribute

removeLogger

public static final boolean removeLogger(Syslogger log)
Deregisters a Syslogger object from Syslog.
Parameters:
log - The logger to remove
Returns:
true if the logger was removed

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.
Returns:
The loggers value

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.
Parameters:
name - The name of the logger to get.
Returns:
The logger

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));
Parameters:
mask - The new logMask value

setLogMask

public static final void setLogMask(java.lang.String mask)
Set the mask.
Parameters:
mask - The new logMask value
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 .

Parameters:
mask - String representation of the mask
Returns:
Computed log mask

getLogMaskAsString

public static java.lang.String getLogMaskAsString()
Get a string representation of the current master log mask.
Returns:
The logMaskAsString value

getLogMaskAsString

public static java.lang.String getLogMaskAsString(int logMask)
Get a string representation of the given log mask.
Parameters:
logMask - The parsed log mask
Returns:
The log mask rendered as a string

inMask

public static final boolean inMask(int level,
                                   int mask)
Check if the given level is covered by the given mask.
Parameters:
level - Log message severity
mask - Log mask to compare it to
Returns:
true if the given level is "in" the mask.

getLogMask

public static final int getLogMask()
Get the default mask for logging of messages.
Returns:
The logMask value

atOrAbove

public static final int atOrAbove(int level)
Parameters:
level - The minimum severity of messages
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 xxx ToChannel(...) 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 xxx ToChannel(...) 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 incomingChannel,
                             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.
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.
incomingChannel - Message channel

log

public static final void log(java.net.InetAddress host,
                             java.lang.Object logger,
                             java.lang.Object incomingChannel,
                             java.lang.Object msg,
                             java.lang.Object detail,
                             int level,
                             java.lang.Thread thread,
                             java.lang.String threadName,
                             long messageSendTime,
                             int traceDepth)
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.
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.
incomingChannel - Channel
traceDepth - Caller's depth in call stack, for computing caller and method names at runtime.

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.
Parameters:
host - hostname
logger - Calling object
e - exception to log

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.
Parameters:
host - hostname
logger - Calling object
e - exception to log
level - Severity to log the message at

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.
Parameters:
logger - Calling object
e - Exception to log

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.
Parameters:
logger - Calling object
e - Exception to log
level - Severity to log the message at

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().
Parameters:
host - hostname
logger - Calling object
message - Message to log

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().
Parameters:
host - hostname
logger - Calling object
message - Message to log
detail - Extended message or exception

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.
Parameters:
host - hostname
logger - Calling object
message - Message to log

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.
Parameters:
host - hostname
logger - Calling object
channel - Channel to log message on
message - Message to log
detail - Extended message or exception

debug

public static final void debug(java.lang.Object logger,
                               java.lang.Object message)
Logs a debug message, which will be converted through toString().
Parameters:
logger - Calling object
message - Message to log

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().
Parameters:
logger - Calling object
message - Message to log
detail - Extended message or exception

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.
Parameters:
logger - Calling object
message - Message to log
channel - Channel to log message on

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.
Parameters:
logger - Calling object
channel - Channel to log message on
message - Message to log
detail - Extended message or exception

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().
Parameters:
host - Hostname
logger - Calling object
message - Message to log

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().
Parameters:
host - Hostname
logger - Calling object
message - Message to log
detail - Extended message or exception

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.
Parameters:
host - Hostname
logger - Calling object
channel - Channel to log message on
message - Message to log

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.
Parameters:
host - Hostname
logger - Calling object
channel - Channel to log message on
message - Message to log
detail - Extended message or exception

info

public static final void info(java.lang.Object logger,
                              java.lang.Object message)
Logs a info message, which will be converted through toString().
Parameters:
logger - Calling object
message - Message to log

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().
Parameters:
logger - Calling object
message - Message to log
detail - Extended message or exception

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.
Parameters:
logger - Calling object
channel - Channel to log message on
message - Message to log

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.
Parameters:
logger - Calling object
channel - Channel to log message on
message - Message to log
detail - Extended message or exception

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().
Parameters:
host - Hostname
logger - Calling object
message - Message to log

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().
Parameters:
host - Hostname
logger - Calling object
message - Message to log
detail - Extended message or exception

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.
Parameters:
host - Hostname
logger - Calling object
channel - Channel to log message on
message - Message to log

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.
Parameters:
host - Hostname
logger - Calling object
channel - Channel to log message on
message - Message to log
detail - Extended message or exception

warning

public static final void warning(java.lang.Object logger,
                                 java.lang.Object message)
Logs a warning message, which will be converted through toString().
Parameters:
logger - Calling object
message - Message to log

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().
Parameters:
logger - Calling object
message - Message to log
detail - Extended message or exception

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.
Parameters:
logger - Calling object
channel - Channel to log message on
message - Message to log

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.
Parameters:
logger - Calling object
channel - Channel to log message on
message - Message to log
detail - Extended message or exception

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().
Parameters:
host - Hostname
logger - Calling object
message - Message to log

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().
Parameters:
host - Hostname
logger - Calling object
message - Message to log
detail - Extended message or exception

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.
Parameters:
host - Hostname
logger - Calling object
channel - Channel to log message on
message - Message to log

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.
Parameters:
host - Hostname
logger - Calling object
channel - Channel to log message on
message - Message to log
detail - Extended message or exception

error

public static final void error(java.lang.Object logger,
                               java.lang.Object message)
Logs a error message, which will be converted through toString().
Parameters:
logger - Calling object
message - Message to log

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().
Parameters:
logger - Calling object
message - Message to log
detail - Extended message or exception

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.
Parameters:
logger - Calling object
channel - Channel to log message on
message - Message to log

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.
Parameters:
logger - Calling object
channel - Channel to log message on
message - Message to log
detail - Extended message or exception

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().
Parameters:
host - Hostname
logger - Calling object
message - Message to log

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().
Parameters:
host - Hostname
logger - Calling object
message - Message to log
detail - Extended message or exception

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.
Parameters:
host - Hostname
logger - Calling object
channel - Channel to log message on
message - Message to log

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.
Parameters:
host - Hostname
logger - Calling object
channel - Channel to log message on
message - Message to log
detail - Extended message or exception

fatal

public static final void fatal(java.lang.Object logger,
                               java.lang.Object message)
Logs a fatal message, which will be converted through toString().
Parameters:
logger - Calling object
message - Message to log

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().
Parameters:
logger - Calling object
message - Message to log
detail - Extended message or exception

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.
Parameters:
logger - Calling object
channel - Channel to log message on
message - Message to log

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.
Parameters:
logger - Calling object
channel - Channel to log message on
message - Message to log
detail - Extended message or exception

crumb

public static final void crumb()
Logs a breadcrumb at the debug level. The breadcrumb includes information from a StackTraceInfo object.

crumb

public static final void crumb(java.lang.Object logger)
Logs a breadcrumb at the debug level. The breadcrumb includes information from a StackTraceInfo object.

crumb

public static final void crumb(java.lang.Object logger,
                               java.lang.Object channel)
Logs a breadcrumb at the debug level.

canLog

public static final boolean canLog(int level)
Deprecated.  

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.
Parameters:
level - Message severity to test
Returns:
True if it is likely to be logged

canDebug

public static final boolean canDebug()
Deprecated.  

Determine if the current syslog mask would allow a message at the DEBUG level to be logged.
Returns:
True if it is likely to be logged

canInfo

public static final boolean canInfo()
Deprecated.  

Determine if the current syslog mask would allow a message at the INFO level to be logged.
Returns:
True if it is likely to be logged

canWarning

public static final boolean canWarning()
Deprecated.  

Determine if the current syslog mask would allow a message at the WARNING level to be logged.
Returns:
True if it is likely to be logged

canError

public static final boolean canError()
Deprecated.  

Determine if the current syslog mask would allow a message at the ERROR level to be logged.
Returns:
True if it is likely to be logged
See Also:
canLog(int)

canFatal

public static final boolean canFatal()
Deprecated.  

Determine if the current syslog mask would allow a message at the FATAL level to be logged.
Returns:
True if it is likely to be logged
See Also:
canLog(int)

mightLog

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

Determine if it's likely that someone will listen to a message from the given logger at the given level.
Parameters:
logger - Calling object
Returns:
True if it is likely to be logged
See Also:
mightLog(Object, int, Object)

mightDebug

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

Determine if it's likely that someone will listen to a debug message from the given logger.
Parameters:
logger - Calling object
Returns:
True if it is likely to be logged
See Also:
mightLog(Object, int, Object)

mightInfo

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

Determine if it's likely that someone will listen to an info message from the given logger.
Parameters:
logger - Calling object
Returns:
True if it is likely to be logged
See Also:
mightLog(Object, int, Object)

mightWarning

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

Determine if it's likely that someone will listen to a warning message from the given logger.
Parameters:
logger - Calling object
Returns:
True if it is likely to be logged
See Also:
mightLog(Object, int, Object)

mightError

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

Determine if it's likely that someone will listen to an error message from the given logger.
Parameters:
logger - Calling object
Returns:
True if it is likely to be logged
See Also:
mightLog(Object, int, Object)

mightFatal

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

Determine if it's likely that someone will listen to a fatal message from the given logger.
Parameters:
logger - Calling object
Returns:
True if it is likely to be logged
See Also:
mightLog(Object, int, Object)

mightDebug

public static final boolean mightDebug(java.lang.Object logger,
                                       java.lang.Object channel)
Deprecated.  

Determine if it's likely that someone will listen to a debug message from the given logger on the given channel(s).
Parameters:
logger - Calling object
channel - Channel name or list
Returns:
True if it is likely to be logged
See Also:
mightLog(Object, int, Object)

mightInfo

public static final boolean mightInfo(java.lang.Object logger,
                                      java.lang.Object channel)
Deprecated.  

Determine if it's likely that someone will listen to an info message from the given logger on the given channel(s).
Parameters:
logger - Calling object
channel - Channel name or list
Returns:
True if it is likely to be logged
See Also:
mightLog(Object, int, Object)

mightWarning

public static final boolean mightWarning(java.lang.Object logger,
                                         java.lang.Object channel)
Deprecated.  

Determine if it's likely that someone will listen to a warning message from the given logger on the given channel(s).
Parameters:
logger - Calling object
channel - Channel name or list
Returns:
True if it is likely to be logged
See Also:
mightLog(Object, int, Object)

mightError

public static final boolean mightError(java.lang.Object logger,
                                       java.lang.Object channel)
Deprecated.  

Determine if it's likely that someone will listen to an error message from the given logger on the given channel(s).
Parameters:
logger - Calling object
channel - Channel name or list
Returns:
True if it is likely to be logged
See Also:
mightLog(Object, int, Object)

mightFatal

public static final boolean mightFatal(java.lang.Object logger,
                                       java.lang.Object channel)
Deprecated.  

Determine if it's likely that someone will listen to a fatal message from the given logger on the given channel(s).
Parameters:
logger - Calling object
channel - Channel name or list
Returns:
True if it is likely to be logged
See Also:
mightLog(Object, int, Object)

mightLog

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

This method has been deprecated. You should use the com.protomatter.util.Debug class instead.
Parameters:
logger - Calling object
level - Message severity
channel - Channel to log message on
Returns:
True if it is likely to be logged

canLog

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

Pass-through to mightLog(Object logger, int level) .
Parameters:
logger - Calling object
level - Message severity
Returns:
True if it is likely to be logged
See Also:
mightLog(Object, int)

canDebug

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

Pass-through to mightDebug(Object logger) .
Parameters:
logger - Calling object
Returns:
True if it is likely to be logged
See Also:
mightDebug(Object)

canInfo

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

Pass-through to mightInfo(Object logger) .
Parameters:
logger - Calling object
Returns:
True if it is likely to be logged
See Also:
mightInfo(Object)

canWarning

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

Pass-through to mightWarning(Object logger) .
Parameters:
logger - Calling object
Returns:
True if it is likely to be logged
See Also:
mightWarning(Object)

canError

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

Pass-through to mightError(Object logger) .
Parameters:
logger - Calling object
Returns:
True if it is likely to be logged
See Also:
mightError(Object)

canFatal

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

Pass-through to mightFatal(Object logger) .
Parameters:
logger - Calling object
Returns:
True if it is likely to be logged
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.
Returns:
The resources value

getResourceString

public static final java.lang.String getResourceString(java.lang.String name)
Get the value of the given resource name associated with Syslog.
Parameters:
name - Resource name to get
Returns:
The resourceString value

Protomatter Software v1.1.8
Copyright 1998-2002 Nate Sammons

Protomatter Software v1.1.8 http://protomatter.sourceforge.net/1.1.8