org.entityfs.support.log
Interface LogAdapter

All Known Implementing Classes:
Jdk14LogAdapter, LogAdapterHolder, ReportLogAdapter, SchmantReportLogAdapter, StdOutLogAdapter

public interface LogAdapter

This is an interface for an adapter to a log system. There are several implementations of this for different logging backends, such as Commons Logging and Java 1.4+ logging.

Clients use this to log messages with different severity levels. Where those messages end up is up to the log adapter implementation used.

The logging levels are

Compared with other logging adapters, such as Commons Logging, the LogAdapter holds its configuration in object instances, rather than in static classes. This makes it easier to have several log adapters in different file systems concurrently without having to invent a way of keeping the static configuration different. The obvious drawback is that all classes that wants to log must find the file system's log adapter to do so. Since most EntityFS classes work against the file system and its entities anyway, that should not be much of a problem.

A FileSystem has a LogAdapter instance that it, and all its entities, use for logging. The file system's log adapter is referenced by the file system's LogAdapterHolder. The log adapter used by the file system can be changed at any time, but the holder is always the same instance. The holder object is passed around to other classes that want to have access to the file system's log adapter. Classes other than the log adapter holder should not save a reference to the file system's log adapter since it may become invalid at any time.

The default adapter is Jdk14LogAdapter. It logs all output to a java.util.logging.Logger.

Since:
1.0
Author:
Karl Gustafsson
See Also:
LogAdapterHolder

Method Summary
 boolean isDebugEnabled()
          Will messages with the level DEBUG be logged?
 boolean isErrorEnabled()
          Will messages with the level ERROR be logged?
 boolean isFinerEnabled()
          Will messages with the level FINER be logged?
 boolean isInfoEnabled()
          Will messages with the level INFO be logged?
 boolean isSevereEnabled()
          Will messages with the level SEVERE be logged?
 boolean isTraceEnabled()
          Will messages with the level TRACE be logged?
 boolean isWarningEnabled()
          Will messages with the level WARNING be logged?
 void logDebug(Object o)
          Log the result of o.toString() with the level DEBUG.
 void logDebug(Object o, Throwable t)
          Log the result of o.toString() and the exception's stack trace to the level DEBUG.
 void logDebug(Throwable t)
          Log the exception's message and stack trace with the level DEBUG.
 void logError(Object o)
          Log the result of o.toString() with the level ERROR.
 void logError(Object o, Throwable t)
          Log the result of o.toString() and the exception's stack trace to the level ERROR.
 void logError(Throwable t)
          Log the exception's message and stack trace with the level ERROR.
 void logFiner(Object o)
          Log the result of o.toString() with the level FINER.
 void logFiner(Object o, Throwable t)
          Log the result of o.toString() and the exception's stack trace to the level FINER.
 void logFiner(Throwable t)
          Log the exception's message and stack trace with the level FINER.
 void logInfo(Object o)
          Log the result of o.toString() with the level INFO.
 void logInfo(Object o, Throwable t)
          Log the result of o.toString() and the exception's stack trace to the level INFO.
 void logInfo(Throwable t)
          Log the exception's message and stack trace with the level INFO.
 void logSevere(Object o)
          Log the result of o.toString() with the level SEVERE.
 void logSevere(Object o, Throwable t)
          Log the result of o.toString() and the exception's stack trace to the level SEVERE.
 void logSevere(Throwable t)
          Log the exception's message and stack trace with the level SEVERE .
 void logTrace(Object o)
          Log the result of o.toString() with the level TRACE.
 void logTrace(Object o, Throwable t)
          Log the result of o.toString() and the exception's stack trace to the level TRACE.
 void logTrace(Throwable t)
          Log the exception's message and stack trace with the level TRACE.
 void logWarning(Object o)
          Log the result of o.toString() with the level WARNING.
 void logWarning(Object o, Throwable t)
          Log the result of o.toString() and the exception's stack trace to the level WARNING.
 void logWarning(Throwable t)
          Log the exception's message and stack trace with the level WARNING.
 void setLevel(Level l)
          Set the log level.
 

Method Detail

logTrace

void logTrace(Object o)
Log the result of o.toString() with the level TRACE.

Parameters:
o - The object to log.

logTrace

void logTrace(Throwable t)
Log the exception's message and stack trace with the level TRACE.

Parameters:
t - The exception to log.

logTrace

void logTrace(Object o,
              Throwable t)
Log the result of o.toString() and the exception's stack trace to the level TRACE.

Parameters:
o - The object to log.
t - The exception to log.

logFiner

void logFiner(Object o)
Log the result of o.toString() with the level FINER.

Parameters:
o - The object to log.

logFiner

void logFiner(Throwable t)
Log the exception's message and stack trace with the level FINER.

Parameters:
t - The exception to log.

logFiner

void logFiner(Object o,
              Throwable t)
Log the result of o.toString() and the exception's stack trace to the level FINER.

Parameters:
o - The object to log.
t - The exception to log.

logDebug

void logDebug(Object o)
Log the result of o.toString() with the level DEBUG.

Parameters:
o - The object to log.

logDebug

void logDebug(Throwable t)
Log the exception's message and stack trace with the level DEBUG.

Parameters:
t - The exception to log.

logDebug

void logDebug(Object o,
              Throwable t)
Log the result of o.toString() and the exception's stack trace to the level DEBUG.

Parameters:
o - The object to log.
t - The exception to log.

logInfo

void logInfo(Object o)
Log the result of o.toString() with the level INFO.

Parameters:
o - The object to log.

logInfo

void logInfo(Throwable t)
Log the exception's message and stack trace with the level INFO.

Parameters:
t - The exception to log.

logInfo

void logInfo(Object o,
             Throwable t)
Log the result of o.toString() and the exception's stack trace to the level INFO.

Parameters:
o - The object to log.
t - The exception to log.

logWarning

void logWarning(Object o)
Log the result of o.toString() with the level WARNING.

Parameters:
o - The object to log.

logWarning

void logWarning(Throwable t)
Log the exception's message and stack trace with the level WARNING.

Parameters:
t - The exception to log.

logWarning

void logWarning(Object o,
                Throwable t)
Log the result of o.toString() and the exception's stack trace to the level WARNING.

Parameters:
o - The object to log.
t - The exception to log.

logError

void logError(Object o)
Log the result of o.toString() with the level ERROR.

Parameters:
o - The object to log.

logError

void logError(Throwable t)
Log the exception's message and stack trace with the level ERROR.

Parameters:
t - The exception to log.

logError

void logError(Object o,
              Throwable t)
Log the result of o.toString() and the exception's stack trace to the level ERROR.

Parameters:
o - The object to log.
t - The exception to log.

logSevere

void logSevere(Object o)
Log the result of o.toString() with the level SEVERE.

Parameters:
o - The object to log.

logSevere

void logSevere(Throwable t)
Log the exception's message and stack trace with the level SEVERE .

Parameters:
t - The exception to log.

logSevere

void logSevere(Object o,
               Throwable t)
Log the result of o.toString() and the exception's stack trace to the level SEVERE.

Parameters:
o - The object to log.
t - The exception to log.

setLevel

void setLevel(Level l)
Set the log level. Use the java.util.logging.Level class to define the level. The Level value is translated to the corresponding logging level in the logging system used by the adapter implementation. See the documentation for that adapter for how the mapping is done.

Parameters:
l - The level.

isTraceEnabled

boolean isTraceEnabled()
Will messages with the level TRACE be logged?

Returns:
true if messages with the level TRACE will be logged, false otherwise.

isFinerEnabled

boolean isFinerEnabled()
Will messages with the level FINER be logged?

Returns:
true if messages with the level FINER will be logged, false otherwise.

isDebugEnabled

boolean isDebugEnabled()
Will messages with the level DEBUG be logged?

Returns:
true if messages with the level DEBUG will be logged, false otherwise.

isInfoEnabled

boolean isInfoEnabled()
Will messages with the level INFO be logged?

Returns:
true if messages with the level INFO will be logged, false otherwise.

isWarningEnabled

boolean isWarningEnabled()
Will messages with the level WARNING be logged?

Returns:
true if messages with the level WARNING will be logged, false otherwise.

isErrorEnabled

boolean isErrorEnabled()
Will messages with the level ERROR be logged?

Returns:
true if messages with the level ERROR will be logged, false otherwise.

isSevereEnabled

boolean isSevereEnabled()
Will messages with the level SEVERE be logged?

Returns:
true if messages with the level SEVERE will be logged, false otherwise.