net.sf.click.extras.service
Class JdkLogService

java.lang.Object
  extended bynet.sf.click.extras.service.JdkLogService
All Implemented Interfaces:
LogService

public class JdkLogService
extends Object
implements LogService

Provides a JDK Util Logging LogService adapter class with a logger name of "Click".

Configuration

To configure the JDK LoggingService add the following element to your click.xml configuration file.
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 <click-app charset="UTF-8">

     <pages package="net.sf.click.examples.page"/>

     <log-service classname="net.sf.click.extras.service.JdkLogService"/>

 </click-app> 

Author:
Malcolm Edgar

Field Summary
protected  Logger logger
          The wrapped JDK logger instance.
protected  String name
          The logger category name.
 
Constructor Summary
JdkLogService()
           
 
Method Summary
 void debug(Object message)
          Log the message at Level.FINE level.
 void debug(Object message, Throwable error)
          Log the message and error at Level.FINE level.
 void error(Object message)
          Log the message at Level.SEVERE level.
 void error(Object message, Throwable error)
          Log the message and error at Level.SEVERE level.
 String getName()
          Return the logger category name.
 void info(Object message)
          Log the message at Level.INFO level.
 void info(Object message, Throwable error)
          Log the message and error at Level.INFO level.
 boolean isDebugEnabled()
          Is logging enabled at the Level.FINE level.
 boolean isInfoEnabled()
          Is logging enabled at the Level.INFO level.
 boolean isTraceEnabled()
          Is Trace logging enabled at the Level.FINER level.
 void onDestroy()
           
 void onInit(ServletContext servletContext)
           
 void setName(String name)
          The logger category name.
 void trace(Object message)
          Log the message at Level.FINER level.
 void trace(Object message, Throwable error)
          Log the message and error at Level.FINER level.
 void warn(Object message)
          Log the message at Level.WARNING level.
 void warn(Object message, Throwable error)
          Log the message and error at Level.WARNING level.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected Logger logger
The wrapped JDK logger instance.


name

protected String name
The logger category name. The default value is "Click".

Constructor Detail

JdkLogService

public JdkLogService()
Method Detail

onInit

public void onInit(ServletContext servletContext)
            throws Exception
Specified by:
onInit in interface LogService
Parameters:
servletContext - the application servlet context
Throws:
Exception - if an error occurs initializing the LogService
See Also:
LogService.onInit(javax.servlet.ServletContext)

onDestroy

public void onDestroy()
Specified by:
onDestroy in interface LogService
See Also:
LogService.onDestroy()

debug

public void debug(Object message)
Log the message at Level.FINE level.

Specified by:
debug in interface LogService
Parameters:
message - the message to log
See Also:
LogService.debug(Object)

debug

public void debug(Object message,
                  Throwable error)
Log the message and error at Level.FINE level.

Specified by:
debug in interface LogService
Parameters:
message - the message to log
error - the error to log
See Also:
LogService.debug(Object, Throwable)

error

public void error(Object message)
Log the message at Level.SEVERE level.

Specified by:
error in interface LogService
Parameters:
message - the message to log
See Also:
LogService.error(Object)

error

public void error(Object message,
                  Throwable error)
Log the message and error at Level.SEVERE level.

Specified by:
error in interface LogService
Parameters:
message - the message to log
error - the error to log
See Also:
LogService.error(Object, Throwable)

info

public void info(Object message)
Log the message at Level.INFO level.

Specified by:
info in interface LogService
Parameters:
message - the message to log
See Also:
LogService.info(Object)

info

public void info(Object message,
                 Throwable error)
Log the message and error at Level.INFO level.

Specified by:
info in interface LogService
Parameters:
message - the message to log
error - the error to log
See Also:
LogService.info(Object, Throwable)

isDebugEnabled

public boolean isDebugEnabled()
Is logging enabled at the Level.FINE level.

Specified by:
isDebugEnabled in interface LogService
Returns:
true if [debug] level logging is enabled
See Also:
LogService.isDebugEnabled()

isInfoEnabled

public boolean isInfoEnabled()
Is logging enabled at the Level.INFO level.

Specified by:
isInfoEnabled in interface LogService
Returns:
true if [info] level logging is enabled
See Also:
LogService.isInfoEnabled()

isTraceEnabled

public boolean isTraceEnabled()
Is Trace logging enabled at the Level.FINER level.

Specified by:
isTraceEnabled in interface LogService
Returns:
true if [trace] level logging is enabled
See Also:
LogService.isTraceEnabled()

trace

public void trace(Object message)
Log the message at Level.FINER level.

Specified by:
trace in interface LogService
Parameters:
message - the message to log
See Also:
LogService.trace(Object)

trace

public void trace(Object message,
                  Throwable error)
Log the message and error at Level.FINER level.

Specified by:
trace in interface LogService
Parameters:
message - the message to log
error - the error to log
See Also:
LogService.trace(Object, Throwable)

warn

public void warn(Object message)
Log the message at Level.WARNING level.

Specified by:
warn in interface LogService
Parameters:
message - the message to log
See Also:
LogService.warn(Object)

warn

public void warn(Object message,
                 Throwable error)
Log the message and error at Level.WARNING level.

Specified by:
warn in interface LogService
Parameters:
message - the message to log
error - the error to log
See Also:
LogService.warn(Object, Throwable)

getName

public String getName()
Return the logger category name.

Returns:
the logger category name

setName

public void setName(String name)
The logger category name. Setting the name after the onInit() method has been invoked will have no effect on the JDK loggers name.

Parameters:
name - the logger category name to set