org.directwebremoting.util
Class ServletLoggingOutput

java.lang.Object
  extended by org.directwebremoting.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
 
Fields inherited from interface org.directwebremoting.util.LoggingOutput
LEVEL_DEBUG, LEVEL_ERROR, LEVEL_FATAL, LEVEL_INFO, LEVEL_WARN
 
Constructor Summary
ServletLoggingOutput(java.lang.Class<?> base)
           
 
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
 

Constructor Detail

ServletLoggingOutput

public ServletLoggingOutput(java.lang.Class<?> base)
Parameters:
base - All LoggingOutput must have a constructor like this
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 2008