org.apache.click.extras.service
Class Slf4jLogService

java.lang.Object
  extended by org.apache.click.extras.service.Slf4jLogService
All Implemented Interfaces:
LogService

public class Slf4jLogService
extends Object
implements LogService

Provides a SLF4J 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="org.apache.click.examples.page"/>

     <log-service classname="org.apache.click.extras.service.Slf4jLogService"/>

 </click-app> 


Field Summary
protected  org.slf4j.Logger logger
          The wrapped JDK logger instance.
protected  String name
          The logger category name.
 
Constructor Summary
Slf4jLogService()
           
 
Method Summary
 void debug(Object message)
           
 void debug(Object message, Throwable error)
           
 void error(Object message)
           
 void error(Object message, Throwable error)
           
 String getName()
          Return the logger category name.
 void info(Object message)
           
 void info(Object message, Throwable error)
           
 boolean isDebugEnabled()
           
 boolean isInfoEnabled()
           
 boolean isTraceEnabled()
           
 void onDestroy()
           
 void onInit(ServletContext servletContext)
           
 void setName(String name)
          The logger category name.
 void trace(Object message)
           
 void trace(Object message, Throwable error)
           
 void warn(Object message)
           
 void warn(Object message, Throwable error)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected org.slf4j.Logger logger
The wrapped JDK logger instance.


name

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

Constructor Detail

Slf4jLogService

public Slf4jLogService()
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)
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)
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)
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)
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)
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)
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()
Specified by:
isDebugEnabled in interface LogService
Returns:
true if [debug] level logging is enabled
See Also:
LogService.isDebugEnabled()

isInfoEnabled

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

isTraceEnabled

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

trace

public void trace(Object message)
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)
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)
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)
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 bee invoked will have no effect on the Log4J loggers name.

Parameters:
name - the logger category name to set