edu.northwestern.at.wordhoard.server
Class Logger

java.lang.Object
  extended by edu.northwestern.at.wordhoard.server.Logger

public class Logger
extends java.lang.Object

Server log manager.

This static class is a simple wrapper around a Jakarta Commons Logging log4j logger named "edu.northwestern.at.wordhoard.server".

The file named "log.config" in the server directory is used to configure the logger.


Field Summary
static int DEBUG
          Debug logging level.
static int ERROR
          Error logging level.
static int FATAL
          Fatal logging level.
static int INFO
          Info logging level.
static int WARN
          Warn logging level.
 
Method Summary
(package private) static void initialize()
          Initializes the logger.
(package private) static void initialize(java.lang.String message)
          Initializes the logger.
(package private) static void log(int level, java.lang.String str)
          Logs a message.
(package private) static void log(int level, java.lang.String str, java.lang.Throwable t)
          Logs an error message with a stack trace.
(package private) static void log(WordHoardSessionImpl session, int level, java.lang.String str)
          Logs a message for a session.
(package private) static void log(WordHoardSessionImpl session, int level, java.lang.String str, java.lang.Throwable t)
          Logs an error message for a session with a stack trace.
(package private) static org.apache.log4j.Priority mapLevel(int level)
          Maps a LoggerConstants level to a log4j level.
(package private) static void terminate()
          Terminates the logger.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FATAL

public static final int FATAL
Fatal logging level.

See Also:
Constant Field Values

ERROR

public static final int ERROR
Error logging level.

See Also:
Constant Field Values

WARN

public static final int WARN
Warn logging level.

See Also:
Constant Field Values

INFO

public static final int INFO
Info logging level.

See Also:
Constant Field Values

DEBUG

public static final int DEBUG
Debug logging level.

See Also:
Constant Field Values
Method Detail

initialize

static void initialize(java.lang.String message)
                throws java.io.FileNotFoundException,
                       java.io.IOException
Initializes the logger.

Parameters:
message - Initial log message.

Reads the "log.config" configuraton file and configures the server logger.

The configuration file is preprocessed to force the log file to be located in the server directory. The server directory path is prepended to the log file name.

Throws:
java.lang.Exception
java.io.FileNotFoundException
java.io.IOException

initialize

static void initialize()
                throws java.io.FileNotFoundException,
                       java.io.IOException
Initializes the logger.

Reads the "log.config" configuraton file and configures the server logger.

The configuration file is preprocessed to force the log file to be located in the server directory. The server directory path is prepended to the log file name.

Throws:
java.lang.Exception
java.io.FileNotFoundException
java.io.IOException

terminate

static void terminate()
Terminates the logger.


mapLevel

static org.apache.log4j.Priority mapLevel(int level)
Maps a LoggerConstants level to a log4j level.

Parameters:
level - LoggerConstants level.
Returns:
log4j level.

log

static void log(int level,
                java.lang.String str)
Logs a message.

Parameters:
level - Log message level.
str - Log message.

log

static void log(WordHoardSessionImpl session,
                int level,
                java.lang.String str)
Logs a message for a session.

Parameters:
session - The session.
level - Log message level.
str - Log message.

log

static void log(int level,
                java.lang.String str,
                java.lang.Throwable t)
Logs an error message with a stack trace.

Parameters:
level - Log message level.
str - Log message.
t - Throwable.

log

static void log(WordHoardSessionImpl session,
                int level,
                java.lang.String str,
                java.lang.Throwable t)
Logs an error message for a session with a stack trace.

Parameters:
session - The session.
level - Log message level.
str - Log message.
t - Throwable.