net.sf.click.service
Interface LogService

All Known Implementing Classes:
ConsoleLogService

public interface LogService

Provides a logging service for the Click runtime.

Configuration

The default LogService implementation is ConsoleLogService.

You can instruct Click to use a different implementation by adding 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="com.mycorp.CustomLogService"/>

 </click-app> 
The class com.mycorp.CustomLogService might be defined as follows:
 package com.mycorp;

 public class CustomLogService extends ConsoleLogService {

     protected void log(int level, String message, Throwable error) {
         // Add custom logic
         ...

         super.log(level, message, error);
     }
 } 

Author:
Malcolm Edgar

Method Summary
 void debug(Object message)
          Log the given message at [debug] logging level.
 void debug(Object message, Throwable error)
          Log the given message and error at [debug] logging level.
 void error(Object message)
          Log the given message at [error] logging level.
 void error(Object message, Throwable error)
          Log the given message and error at [error] logging level.
 void info(Object message)
          Log the given message at [info] logging level.
 void info(Object message, Throwable error)
          Log the given message and error at [info] logging level.
 boolean isDebugEnabled()
          Return true if [debug] level logging is enabled.
 boolean isInfoEnabled()
          Return true if [info] level logging is enabled.
 boolean isTraceEnabled()
          Return true if [trace] level logging is enabled.
 void onDestroy()
          Destroy the LogService.
 void onInit(ServletContext servletContext)
          Initialize the LogService with the given application servlet context.
 void trace(Object message)
          Log the given message at [trace] logging level.
 void trace(Object message, Throwable error)
          Log the given message and error at [trace] logging level.
 void warn(Object message)
          Log the given message at [warn] logging level.
 void warn(Object message, Throwable error)
          Log the given message and error at [warn] logging level.
 

Method Detail

onInit

public void onInit(ServletContext servletContext)
            throws Exception
Initialize the LogService with the given application servlet context.

This method is invoked after the LogService has been constructed.

Note you can access ConfigService by invoking ClickUtils.getConfigService(javax.servlet.ServletContext)

Parameters:
servletContext - the application servlet context
Throws:
Exception - if an error occurs initializing the LogService

onDestroy

public void onDestroy()
Destroy the LogService.


debug

public void debug(Object message)
Log the given message at [debug] logging level.

Parameters:
message - the message to log

debug

public void debug(Object message,
                  Throwable error)
Log the given message and error at [debug] logging level.

Parameters:
message - the message to log
error - the error to log

error

public void error(Object message)
Log the given message at [error] logging level.

Parameters:
message - the message to log

error

public void error(Object message,
                  Throwable error)
Log the given message and error at [error] logging level.

Parameters:
message - the message to log
error - the error to log

info

public void info(Object message)
Log the given message at [info] logging level.

Parameters:
message - the message to log

info

public void info(Object message,
                 Throwable error)
Log the given message and error at [info] logging level.

Parameters:
message - the message to log
error - the error to log

trace

public void trace(Object message)
Log the given message at [trace] logging level.

Parameters:
message - the message to log

trace

public void trace(Object message,
                  Throwable error)
Log the given message and error at [trace] logging level.

Parameters:
message - the message to log
error - the error to log

warn

public void warn(Object message)
Log the given message at [warn] logging level.

Parameters:
message - the message to log

warn

public void warn(Object message,
                 Throwable error)
Log the given message and error at [warn] logging level.

Parameters:
message - the message to log
error - the error to log

isDebugEnabled

public boolean isDebugEnabled()
Return true if [debug] level logging is enabled.

Returns:
true if [debug] level logging is enabled

isInfoEnabled

public boolean isInfoEnabled()
Return true if [info] level logging is enabled.

Returns:
true if [info] level logging is enabled

isTraceEnabled

public boolean isTraceEnabled()
Return true if [trace] level logging is enabled.

Returns:
true if [trace] level logging is enabled