org.jclouds.logging
Interface Logger

All Known Implementing Classes:
AntLogger, BaseLogger, ConsoleLogger, JDKLogger, Log4JLogger, NullLogger, SLF4JLogger

public interface Logger

JCloud log abstraction layer.

Implementations of logging are optional and injected if they are configured.

@Resource Logger logger = Logger.NULL; The above will get you a null-safe instance of Logger. If configured, this logger will be swapped with a real Logger implementation with category set to the current class name. This is done post-object construction, so do not attempt to use these loggers in your constructor.

If you wish to initialize loggers like these yourself, do not use the @Resource annotation.

This implementation first checks to see if the level is enabled before issuing the log command. In other words, don't do the following if (logger.isTraceEnabled()) logger.trace("message");.

Author:
Adrian Cole

Nested Class Summary
static interface Logger.LoggerFactory
          Produces instances of Logger relevant to the specified category
 
Field Summary
static Logger CONSOLE
          Assign to member to avoid NPE when no logging module is configured.
static Logger NULL
          Assign to member to avoid NPE when no logging module is configured.
 
Method Summary
 void debug(String message, Object... args)
           
 void error(String message, Object... args)
           
 void error(Throwable throwable, String message, Object... args)
           
 String getCategory()
           
 void info(String message, Object... args)
           
 boolean isDebugEnabled()
           
 boolean isErrorEnabled()
           
 boolean isInfoEnabled()
           
 boolean isTraceEnabled()
           
 boolean isWarnEnabled()
           
 void trace(String message, Object... args)
           
 void warn(String message, Object... args)
           
 void warn(Throwable throwable, String message, Object... args)
           
 

Field Detail

NULL

static final Logger NULL
Assign to member to avoid NPE when no logging module is configured.


CONSOLE

static final Logger CONSOLE
Assign to member to avoid NPE when no logging module is configured.

Method Detail

getCategory

String getCategory()

trace

void trace(String message,
           Object... args)

isTraceEnabled

boolean isTraceEnabled()

debug

void debug(String message,
           Object... args)

isDebugEnabled

boolean isDebugEnabled()

info

void info(String message,
          Object... args)

isInfoEnabled

boolean isInfoEnabled()

warn

void warn(String message,
          Object... args)

warn

void warn(Throwable throwable,
          String message,
          Object... args)

isWarnEnabled

boolean isWarnEnabled()

error

void error(String message,
           Object... args)

error

void error(Throwable throwable,
           String message,
           Object... args)

isErrorEnabled

boolean isErrorEnabled()


Copyright © 2009-2012 jclouds. All Rights Reserved.