org.apache.avalon.excalibur.logger
Class ServletLogger

java.lang.Object
  extended byorg.apache.avalon.excalibur.logger.ServletLogger
All Implemented Interfaces:
Logger

public class ServletLogger
extends java.lang.Object
implements Logger

Logger to bootstrap avalon application iside a servlet. Intended to be used as a logger for Fortress ContextManager/ContainerManager. Adapted from ConsoleLogger.

Version:
CVS $Revision: 1.5 $ $Date: 2004/03/10 13:54:50 $
Author:
Avalon Development Team

Field Summary
static int LEVEL_DEBUG
          Typecode for debugging messages.
static int LEVEL_DISABLED
          Typecode for disabled log levels.
static int LEVEL_ERROR
          Typecode for error messages.
static int LEVEL_FATAL
          Typecode for fatal error messages.
static int LEVEL_INFO
          Typecode for informational messages.
static int LEVEL_WARN
          Typecode for warning messages.
 
Constructor Summary
ServletLogger(javax.servlet.ServletConfig servletConfig)
          Creates a new ServletLogger with the priority set to DEBUG.
ServletLogger(javax.servlet.ServletConfig servletConfig, int logLevel)
          Creates a new ServletLogger.
ServletLogger(javax.servlet.ServletContext servletContext, java.lang.String prompt, int logLevel)
          Creates a new ServletLogger.
 
Method Summary
 void debug(java.lang.String message)
          Logs a debugging message.
 void debug(java.lang.String message, java.lang.Throwable throwable)
          Logs a debugging message and an exception.
 void error(java.lang.String message)
          Logs an error message.
 void error(java.lang.String message, java.lang.Throwable throwable)
          Logs an error message and an exception.
 void fatalError(java.lang.String message)
          Logs a fatal error message.
 void fatalError(java.lang.String message, java.lang.Throwable throwable)
          Logs a fatal error message and an exception.
 Logger getChildLogger(java.lang.String name)
          Just returns this logger (ServletLogger is not hierarchical).
 void info(java.lang.String message)
          Logs an informational message.
 void info(java.lang.String message, java.lang.Throwable throwable)
          Logs an informational message and an exception.
 boolean isDebugEnabled()
          Returns true if debug-level logging is enabled, false otherwise.
 boolean isErrorEnabled()
          Returns true if error-level logging is enabled, false otherwise.
 boolean isFatalErrorEnabled()
          Returns true if fatal-level logging is enabled, false otherwise.
 boolean isInfoEnabled()
          Returns true if info-level logging is enabled, false otherwise.
 boolean isWarnEnabled()
          Returns true if warn-level logging is enabled, false otherwise.
 void warn(java.lang.String message)
          Logs a warning message.
 void warn(java.lang.String message, java.lang.Throwable throwable)
          Logs a warning message and an exception.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LEVEL_DEBUG

public static final int LEVEL_DEBUG
Typecode for debugging messages.

See Also:
Constant Field Values

LEVEL_INFO

public static final int LEVEL_INFO
Typecode for informational messages.

See Also:
Constant Field Values

LEVEL_WARN

public static final int LEVEL_WARN
Typecode for warning messages.

See Also:
Constant Field Values

LEVEL_ERROR

public static final int LEVEL_ERROR
Typecode for error messages.

See Also:
Constant Field Values

LEVEL_FATAL

public static final int LEVEL_FATAL
Typecode for fatal error messages.

See Also:
Constant Field Values

LEVEL_DISABLED

public static final int LEVEL_DISABLED
Typecode for disabled log levels.

See Also:
Constant Field Values
Constructor Detail

ServletLogger

public ServletLogger(javax.servlet.ServletConfig servletConfig)
Creates a new ServletLogger with the priority set to DEBUG.


ServletLogger

public ServletLogger(javax.servlet.ServletContext servletContext,
                     java.lang.String prompt,
                     int logLevel)
Creates a new ServletLogger.

Parameters:
servletContext - ServletContext to log messages to
prompt - text to prepend to every message
logLevel - log level typecode

ServletLogger

public ServletLogger(javax.servlet.ServletConfig servletConfig,
                     int logLevel)
Creates a new ServletLogger.

Parameters:
servletConfig - the servletConfig to extract ServletContext from; also the servlet name is extracted to be prepended to every message.
logLevel - log level typecode
Method Detail

debug

public void debug(java.lang.String message)
Logs a debugging message.

Specified by:
debug in interface Logger
Parameters:
message - a String value

debug

public void debug(java.lang.String message,
                  java.lang.Throwable throwable)
Logs a debugging message and an exception.

Specified by:
debug in interface Logger
Parameters:
message - a String value
throwable - a Throwable value

isDebugEnabled

public boolean isDebugEnabled()
Returns true if debug-level logging is enabled, false otherwise.

Specified by:
isDebugEnabled in interface Logger
Returns:
true if debug-level logging

info

public void info(java.lang.String message)
Logs an informational message.

Specified by:
info in interface Logger
Parameters:
message - a String value

info

public void info(java.lang.String message,
                 java.lang.Throwable throwable)
Logs an informational message and an exception.

Specified by:
info in interface Logger
Parameters:
message - a String value
throwable - a Throwable value

isInfoEnabled

public boolean isInfoEnabled()
Returns true if info-level logging is enabled, false otherwise.

Specified by:
isInfoEnabled in interface Logger
Returns:
true if info-level logging is enabled

warn

public void warn(java.lang.String message)
Logs a warning message.

Specified by:
warn in interface Logger
Parameters:
message - a String value

warn

public void warn(java.lang.String message,
                 java.lang.Throwable throwable)
Logs a warning message and an exception.

Specified by:
warn in interface Logger
Parameters:
message - a String value
throwable - a Throwable value

isWarnEnabled

public boolean isWarnEnabled()
Returns true if warn-level logging is enabled, false otherwise.

Specified by:
isWarnEnabled in interface Logger
Returns:
true if warn-level logging is enabled

error

public void error(java.lang.String message)
Logs an error message.

Specified by:
error in interface Logger
Parameters:
message - a String value

error

public void error(java.lang.String message,
                  java.lang.Throwable throwable)
Logs an error message and an exception.

Specified by:
error in interface Logger
Parameters:
message - a String value
throwable - a Throwable value

isErrorEnabled

public boolean isErrorEnabled()
Returns true if error-level logging is enabled, false otherwise.

Specified by:
isErrorEnabled in interface Logger
Returns:
true if error-level logging is enabled

fatalError

public void fatalError(java.lang.String message)
Logs a fatal error message.

Specified by:
fatalError in interface Logger
Parameters:
message - a String value

fatalError

public void fatalError(java.lang.String message,
                       java.lang.Throwable throwable)
Logs a fatal error message and an exception.

Specified by:
fatalError in interface Logger
Parameters:
message - a String value
throwable - a Throwable value

isFatalErrorEnabled

public boolean isFatalErrorEnabled()
Returns true if fatal-level logging is enabled, false otherwise.

Specified by:
isFatalErrorEnabled in interface Logger
Returns:
true if fatal-level logging is enabled

getChildLogger

public Logger getChildLogger(java.lang.String name)
Just returns this logger (ServletLogger is not hierarchical).

Specified by:
getChildLogger in interface Logger
Parameters:
name - ignored
Returns:
this logger


Copyright © 1997-2005 The Apache Software Foundation. All Rights Reserved.