NetKernel APIs


com.ten60.netkernel.util
Class SysLogger

java.lang.Object
  extended bycom.ten60.netkernel.util.SysLogger

public class SysLogger
extends Object

Wrapper class around the Logger class. Avoids having to fiddle with the properties file (set all logging allowed and filter message through this class). Also allows check to see if logging allowed before wasting time calling log. Optionally allows logging of Documents and methods. Is a singleton wrapper. Allows use of parameters in logging expressions. Dynamic configuration of logging.


Field Summary
static int APPLICATION
           
static int CACHE
           
static int CONTAINER
           
static int DEBUG
           
static int FINE
           
static int INFO
           
static boolean logMethods
          Controls whether the calling method is written (true) to the log file.
static char NEWLINE_SUBSTITUTE
           
static int SEVERE
           
static int WARNING
           
 
Method Summary
static void addHandler(Handler h)
          Add a handler to this logger
static void config(String aBasePath, XMLReadable config)
           
static int getErrorCount()
           
static Handler getHandler(String classname)
          Get a handler identified by class name
static int getWarningCount()
           
static void log(int level, Object callingObject, String _msg)
          This will always attempt to log.
static void log1(int level, Object callingObject, String msg, Object p1)
          Adds a log entry with one parameter.
static void log2(int level, Object callingObject, String msg, Object p1, Object p2)
          Adds a log entry with two parameters.
static void log3(int level, Object callingObject, String msg, Object p1, Object p2, Object p3)
          Adds a log entry with three parameters.
static void log4(int level, Object callingObject, String msg, Object p1, Object p2, Object p3, Object p4)
          Adds a log entry with four parameters.
static void resetHandlers()
          Reset and remove Log Handlers
static void resetStats()
           
static void setLoggingFor(int level, boolean on)
          Toggle whether to log messages of a certain level.
static boolean shouldLog(int level, Object callingObject)
          Indicates whether a log message of the specified level will be logged.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NEWLINE_SUBSTITUTE

public static final char NEWLINE_SUBSTITUTE
See Also:
Constant Field Values

logMethods

public static final boolean logMethods
Controls whether the calling method is written (true) to the log file.

See Also:
Constant Field Values

FINE

public static final int FINE
See Also:
Constant Field Values

INFO

public static final int INFO
See Also:
Constant Field Values

WARNING

public static final int WARNING
See Also:
Constant Field Values

SEVERE

public static final int SEVERE
See Also:
Constant Field Values

DEBUG

public static final int DEBUG
See Also:
Constant Field Values

APPLICATION

public static final int APPLICATION
See Also:
Constant Field Values

CONTAINER

public static final int CONTAINER
See Also:
Constant Field Values

CACHE

public static final int CACHE
See Also:
Constant Field Values
Method Detail

shouldLog

public static boolean shouldLog(int level,
                                Object callingObject)
Indicates whether a log message of the specified level will be logged.

Parameters:
level - The log level for the message.
callingObject - The object requesting the log message be recorded
Returns:
true if a log message of the specified level will be logged.

addHandler

public static void addHandler(Handler h)
Add a handler to this logger


getHandler

public static Handler getHandler(String classname)
Get a handler identified by class name


setLoggingFor

public static void setLoggingFor(int level,
                                 boolean on)
Toggle whether to log messages of a certain level.

Parameters:
level - The logging level.
on - If true, log messages for the specified level will be recorded.

resetHandlers

public static void resetHandlers()
Reset and remove Log Handlers


log1

public static void log1(int level,
                        Object callingObject,
                        String msg,
                        Object p1)
Adds a log entry with one parameter.

Parameters:
level - The log level for the message.
callingObject - The object requesting the log message be recorded
msg - The message to record.
p1 - The first paramter to add to the message

log2

public static void log2(int level,
                        Object callingObject,
                        String msg,
                        Object p1,
                        Object p2)
Adds a log entry with two parameters.

Parameters:
level - The log level for the message.
callingObject - The object requesting the log message be recorded
msg - The message to record.
p1 - The first paramter to add to the message
p2 - The second paramter to add to the message

log3

public static void log3(int level,
                        Object callingObject,
                        String msg,
                        Object p1,
                        Object p2,
                        Object p3)
Adds a log entry with three parameters.

Parameters:
level - The log level for the message.
callingObject - The object requesting the log message be recorded
msg - The message to record.
p1 - The first paramter to add to the message
p2 - The second paramter to add to the message
p3 - The third paramter to add to the message

log4

public static void log4(int level,
                        Object callingObject,
                        String msg,
                        Object p1,
                        Object p2,
                        Object p3,
                        Object p4)
Adds a log entry with four parameters.

Parameters:
level - The log level for the message.
callingObject - The object requesting the log message be recorded
msg - The message to record.
p1 - The first paramter to add to the message
p2 - The second paramter to add to the message
p3 - The third paramter to add to the message
p4 - The fourth paramter to add to the message

log

public static final void log(int level,
                             Object callingObject,
                             String _msg)
This will always attempt to log. Call shouldLog first to see if the message should be logged according to the SysLogger settings.

Parameters:
level - The log level for the message.
callingObject - The object requesting the log message be recorded

config

public static void config(String aBasePath,
                          XMLReadable config)

resetStats

public static void resetStats()

getErrorCount

public static int getErrorCount()

getWarningCount

public static int getWarningCount()

NetKernel APIs


Copyright © 2002-2004 1060 Research Ltd. All Rights Reserved.