uk.ltd.getahead.dwr.util
Class ServletLoggingOutput

java.lang.Object
  extended byuk.ltd.getahead.dwr.util.ServletLoggingOutput
All Implemented Interfaces:
LoggingOutput

public class ServletLoggingOutput
extends java.lang.Object
implements LoggingOutput

An implementation of LoggingOutput that sends stuff to the Servlet.log stream.

Author:
Joe Walker [joe at getahead dot ltd dot uk]

Field Summary
static int LEVEL_DEBUG
          Testing information.
static int LEVEL_ERROR
          Something has gone wrong with the current request.
static int LEVEL_FATAL
          Something has gone very badly wrong.
static int LEVEL_INFO
          An event happened that we might need to keep track of.
static int LEVEL_WARN
          Something has gone wrong, but it could well be the users fault.
 
Constructor Summary
ServletLoggingOutput()
           
 
Method Summary
 void debug(java.lang.String message)
          Logger a debug message
 void error(java.lang.String message)
          Logger an error message
 void error(java.lang.String message, java.lang.Throwable th)
          Logger an error message
 void fatal(java.lang.String message)
          Logger a fatal error message
 void fatal(java.lang.String message, java.lang.Throwable th)
          Logger a fatal error message
static int getLevel()
           
 void info(java.lang.String message)
          Logger an info message
 boolean isDebugEnabled()
          Save CPU time when we are not debugging
static void setExecutionContext(javax.servlet.http.HttpServlet servlet)
          Associate a servlet with this thread for logging purposes.
static void setLevel(int level)
           
static void setLevel(java.lang.String logLevel)
          String version of setLevel.
static void unsetExecutionContext()
          Remove the servlet from this thread for logging purposes
 void warn(java.lang.String message)
          Logger a warning message
 void warn(java.lang.String message, java.lang.Throwable th)
          Logger a warning message
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LEVEL_FATAL

public static final int LEVEL_FATAL
Something has gone very badly wrong. Processing is likely to stop.

See Also:
Constant Field Values

LEVEL_ERROR

public static final int LEVEL_ERROR
Something has gone wrong with the current request. The user will notice that we've broken something.

See Also:
Constant Field Values

LEVEL_WARN

public static final int LEVEL_WARN
Something has gone wrong, but it could well be the users fault. No need to panic yet.

See Also:
Constant Field Values

LEVEL_INFO

public static final int LEVEL_INFO
An event happened that we might need to keep track of.

See Also:
Constant Field Values

LEVEL_DEBUG

public static final int LEVEL_DEBUG
Testing information.

See Also:
Constant Field Values
Constructor Detail

ServletLoggingOutput

public ServletLoggingOutput()
Method Detail

debug

public void debug(java.lang.String message)
Description copied from interface: LoggingOutput
Logger a debug message

Specified by:
debug in interface LoggingOutput
Parameters:
message - The text to log

info

public void info(java.lang.String message)
Description copied from interface: LoggingOutput
Logger an info message

Specified by:
info in interface LoggingOutput
Parameters:
message - The text to log

warn

public void warn(java.lang.String message)
Description copied from interface: LoggingOutput
Logger a warning message

Specified by:
warn in interface LoggingOutput
Parameters:
message - The text to log

warn

public void warn(java.lang.String message,
                 java.lang.Throwable th)
Description copied from interface: LoggingOutput
Logger a warning message

Specified by:
warn in interface LoggingOutput
Parameters:
message - The text to log
th - An optional stack trace

error

public void error(java.lang.String message)
Description copied from interface: LoggingOutput
Logger an error message

Specified by:
error in interface LoggingOutput
Parameters:
message - The text to log

error

public void error(java.lang.String message,
                  java.lang.Throwable th)
Description copied from interface: LoggingOutput
Logger an error message

Specified by:
error in interface LoggingOutput
Parameters:
message - The text to log
th - An optional stack trace

fatal

public void fatal(java.lang.String message)
Description copied from interface: LoggingOutput
Logger a fatal error message

Specified by:
fatal in interface LoggingOutput
Parameters:
message - The text to log

fatal

public void fatal(java.lang.String message,
                  java.lang.Throwable th)
Description copied from interface: LoggingOutput
Logger a fatal error message

Specified by:
fatal in interface LoggingOutput
Parameters:
message - The text to log
th - An optional stack trace

setExecutionContext

public static void setExecutionContext(javax.servlet.http.HttpServlet servlet)
Associate a servlet with this thread for logging purposes.

Parameters:
servlet - The servlet to use for logging in this thread

unsetExecutionContext

public static void unsetExecutionContext()
Remove the servlet from this thread for logging purposes


setLevel

public static void setLevel(java.lang.String logLevel)
String version of setLevel.

Parameters:
logLevel - One of FATAL, ERROR, WARN, INFO, DEBUG

isDebugEnabled

public boolean isDebugEnabled()
Description copied from interface: LoggingOutput
Save CPU time when we are not debugging

Specified by:
isDebugEnabled in interface LoggingOutput
Returns:
true if debugging is enabled

setLevel

public static void setLevel(int level)
Parameters:
level - The logging level to set.

getLevel

public static int getLevel()
Returns:
Returns the logging level.

Copyright ? 2005