org.apache.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="org.apache.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

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

void onDestroy()
Destroy the LogService.


debug

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

Parameters:
message - the message to log

debug

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

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

Parameters:
message - the message to log

error

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

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

Parameters:
message - the message to log

info

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

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

Parameters:
message - the message to log

trace

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

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

Parameters:
message - the message to log

warn

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

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

Returns:
true if [debug] level logging is enabled

isInfoEnabled

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

Returns:
true if [info] level logging is enabled

isTraceEnabled

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

Returns:
true if [trace] level logging is enabled