org.apache.jackrabbit.spi.commons.logging
Class Slf4jLogWriter

java.lang.Object
  extended by org.apache.jackrabbit.spi.commons.logging.Slf4jLogWriter
All Implemented Interfaces:
LogWriter

public class Slf4jLogWriter
extends Object
implements LogWriter

LogWriter implementation which uses SLF4J for persisting log messages.


Constructor Summary
Slf4jLogWriter(org.slf4j.Logger log)
          Create a new instance which uses the passed SLF4J logger for persisting the log messages.
 
Method Summary
 void enter(String methodName, Object[] args)
          Logs the call at debug level is debug level is enabled.
 void error(String methodName, Object[] args, Exception e)
          Logs the exception including a stack trace at debug level is debug level is enabled.
 void leave(String methodName, Object[] args, Object result)
          Logs the call at debug level is debug level is enabled.
 long systemTime()
          Returns System.currentTimeMillis(); Implementation specific time stamp which is logged along with each log message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Slf4jLogWriter

public Slf4jLogWriter(org.slf4j.Logger log)
Create a new instance which uses the passed SLF4J logger for persisting the log messages.

Parameters:
log -
Method Detail

systemTime

public long systemTime()
Returns
   System.currentTimeMillis();
 
Implementation specific time stamp which is logged along with each log message. The values returned by this method should be monotone with respect to the time they represent.

Specified by:
systemTime in interface LogWriter
Returns:

enter

public void enter(String methodName,
                  Object[] args)
Logs the call at debug level is debug level is enabled. Called right before a method of a SPI entity is called.

Specified by:
enter in interface LogWriter
Parameters:
methodName - name of the method which a about to be called
args - arguments passed to the methods which is about to be called.

leave

public void leave(String methodName,
                  Object[] args,
                  Object result)
Logs the call at debug level is debug level is enabled. Called right after a method of a SPI entity has been called if no exception was thrown.

Specified by:
leave in interface LogWriter
Parameters:
methodName - name of the method which has been called
args - arguments passed to the method which has been called
result - return value of the method which has been called

error

public void error(String methodName,
                  Object[] args,
                  Exception e)
Logs the exception including a stack trace at debug level is debug level is enabled. Called right after a method of a SPI entity has been called and an exception was thrown.

Specified by:
error in interface LogWriter
Parameters:
methodName - name of the method which has been called
args - arguments passed to the method which has been called
e - exception which was thrown by the method which has been called


Copyright © 2004-2010 The Apache Software Foundation. All Rights Reserved.