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

com.protomatter.syslog
Class SimpleLogPolicy

java.lang.Object
  |
  +--com.protomatter.syslog.SimpleLogPolicy
All Implemented Interfaces:
LogPolicy
Direct Known Subclasses:
JDK14PerChannelPolicy, JDK14PerChannelPolicy.PolicyGroup, JDK14PerClassPolicy, JDK14PerClassPolicy.PolicyGroup, PerChannelPolicy, PerChannelPolicy.PolicyGroup, PerClassPolicy, PerClassPolicy.PolicyGroup

public class SimpleLogPolicy
extends java.lang.Object
implements LogPolicy

The default LogPolicy that knows about log levels and channels.

See Also:
LogPolicy, XML configuration class

Constructor Summary
SimpleLogPolicy()
          All channels are listened to by default, and the default log mask is inherited from Syslog itself.
 
Method Summary
 void addChannel(java.lang.String channel)
          Add the given channel to the list of channels we are listening to.
 java.util.Iterator getChannels()
          Get the list of channels this policy listens to.
 int getLogMask()
          Get the mask for logging of messages.
 java.lang.String getName()
          Get the name of this policy.
protected  boolean inMask(int level, int mask)
          Check if the given level is covered by the given mask.
 void removeAllChannels()
          Remove all channels from the list of channels we are listening to.
 void removeChannel(java.lang.String channel)
          Remove the given channel from the list of channels we are listening to.
 void setChannels(java.util.List channels)
          Set the list of channels to use.
 void setChannels(java.util.Set channelSet)
          Set the list of channels to use.
 void setLogMask(int mask)
          Set the mask for logging of messages.
 void setLogMask(java.lang.String mask)
          Set the log mask.
 void setName(java.lang.String name)
          Set the name of this policy.
 boolean shouldLog(SyslogMessage message)
          Determine if a log message should be logged given the information.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleLogPolicy

public SimpleLogPolicy()
All channels are listened to by default, and the default log mask is inherited from Syslog itself.
Method Detail

getName

public java.lang.String getName()
Get the name of this policy.
Specified by:
getName in interface LogPolicy

setName

public void setName(java.lang.String name)
Set the name of this policy.
Specified by:
setName in interface LogPolicy

setChannels

public void setChannels(java.util.List channels)
Set the list of channels to use. Channel names are values in the vector.

setChannels

public void setChannels(java.util.Set channelSet)
Set the list of channels to use. Channel names are looked for as keys in the hashtable.

addChannel

public void addChannel(java.lang.String channel)
Add the given channel to the list of channels we are listening to.

removeChannel

public void removeChannel(java.lang.String channel)
Remove the given channel from the list of channels we are listening to.

removeAllChannels

public void removeAllChannels()
Remove all channels from the list of channels we are listening to.

getChannels

public java.util.Iterator getChannels()
Get the list of channels this policy listens to.

shouldLog

public boolean shouldLog(SyslogMessage message)
Determine if a log message should be logged given the information. Only checks to see if the log level is in the mask.
Specified by:
shouldLog in interface LogPolicy

inMask

protected final boolean inMask(int level,
                               int mask)
Check if the given level is covered by the given mask.

setLogMask

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

setLogMask

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

getLogMask

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

Protomatter Software v1.1.7
Copyright 1998-2002 Nate Sammons

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