EAF 7.6 Implementation

org.enhydra.logging
Class CommonLoggingMonologLogger

java.lang.Object
  extended by org.enhydra.logging.CommonLoggingMonologLogger
All Implemented Interfaces:
org.apache.commons.logging.Log

public final class CommonLoggingMonologLogger
extends java.lang.Object
implements org.apache.commons.logging.Log

Implementation of Log that maps directly to a Monolog Logger. Initial configuration of the corresponding Logger instances should be done in the usual manner, as outlined in the Monolog documentation.

Author:
Igor Smirnov

Field Summary
static java.lang.String PROPERTY_FILE
           
 
Constructor Summary
CommonLoggingMonologLogger()
           
CommonLoggingMonologLogger(org.objectweb.util.monolog.api.Logger logger)
          For use with a Monolog factory
CommonLoggingMonologLogger(java.lang.String name)
          Base constructor
 
Method Summary
 void configure()
          Default configuration of the logger.
 void configure(java.lang.String monologConfFile)
          Configure the logger.
 void debug(java.lang.Object message)
          Log a message to the CommonLoggingMonologLogger Logger with DEBUG priority.
 void debug(java.lang.Object message, java.lang.Throwable t)
          Log an error to the CommonLoggingMonologLogger Logger with DEBUG priority.
 void error(java.lang.Object message)
          Log a message to the CommonLoggingMonologLogger Logger with ERROR priority.
 void error(java.lang.Object message, java.lang.Throwable t)
          Log an error to the CommonLoggingMonologLogger Logger with ERROR priority.
 void fatal(java.lang.Object message)
          Log a message to the CommonLoggingMonologLogger Logger with FATAL priority.
 void fatal(java.lang.Object message, java.lang.Throwable t)
          Log an error to the CommonLoggingMonologLogger Logger with FATAL priority.
 org.objectweb.util.monolog.api.Logger getLogger()
          Return the native Logger instance we are using.
 void info(java.lang.Object message)
          Log a message to the CommonLoggingMonologLogger Logger with INFO priority.
 void info(java.lang.Object message, java.lang.Throwable t)
          Log an error to the CommonLoggingMonologLogger Logger with INFO priority.
 boolean isDebugEnabled()
          Check whether the CommonLoggingMonologLogger Logger used is enabled for DEBUG priority.
 boolean isErrorEnabled()
          Check whether the CommonLoggingMonologLogger Logger used is enabled for ERROR priority.
 boolean isFatalEnabled()
          Check whether the CommonLoggingMonologLogger Logger used is enabled for FATAL priority.
 boolean isInfoEnabled()
          Check whether the CommonLoggingMonologLogger Logger used is enabled for INFO priority.
 boolean isTraceEnabled()
          Check whether the CommonLoggingMonologLogger Logger used is enabled for TRACE priority.
 boolean isWarnEnabled()
          Check whether the CommonLoggingMonologLogger Logger used is enabled for WARN priority.
 void trace(java.lang.Object message)
          Log a message to the CommonLoggingMonologLogger with TRACE priority.
 void trace(java.lang.Object message, java.lang.Throwable t)
          Log an error to the CommonLoggingMonologLogger Logger with TRACE priority.
 void warn(java.lang.Object message)
          Log a message to the CommonLoggingMonologLogger Logger with WARN priority.
 void warn(java.lang.Object message, java.lang.Throwable t)
          Log an error to the CommonLoggingMonologLogger Logger with WARN priority.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPERTY_FILE

public static java.lang.String PROPERTY_FILE
Constructor Detail

CommonLoggingMonologLogger

public CommonLoggingMonologLogger()
                           throws com.lutris.util.ConfigException
Throws:
com.lutris.util.ConfigException

CommonLoggingMonologLogger

public CommonLoggingMonologLogger(java.lang.String name)
                           throws com.lutris.util.ConfigException
Base constructor

Throws:
com.lutris.util.ConfigException

CommonLoggingMonologLogger

public CommonLoggingMonologLogger(org.objectweb.util.monolog.api.Logger logger)
For use with a Monolog factory

Method Detail

trace

public void trace(java.lang.Object message)
Log a message to the CommonLoggingMonologLogger with TRACE priority. Currently logs to DEBUG level in CommonLoggingMonologLogger.

Specified by:
trace in interface org.apache.commons.logging.Log

trace

public void trace(java.lang.Object message,
                  java.lang.Throwable t)
Log an error to the CommonLoggingMonologLogger Logger with TRACE priority. Currently logs to DEBUG level in CommonLoggingMonologLogger.

Specified by:
trace in interface org.apache.commons.logging.Log

debug

public void debug(java.lang.Object message)
Log a message to the CommonLoggingMonologLogger Logger with DEBUG priority.

Specified by:
debug in interface org.apache.commons.logging.Log

debug

public void debug(java.lang.Object message,
                  java.lang.Throwable t)
Log an error to the CommonLoggingMonologLogger Logger with DEBUG priority.

Specified by:
debug in interface org.apache.commons.logging.Log

info

public void info(java.lang.Object message)
Log a message to the CommonLoggingMonologLogger Logger with INFO priority.

Specified by:
info in interface org.apache.commons.logging.Log

info

public void info(java.lang.Object message,
                 java.lang.Throwable t)
Log an error to the CommonLoggingMonologLogger Logger with INFO priority.

Specified by:
info in interface org.apache.commons.logging.Log

warn

public void warn(java.lang.Object message)
Log a message to the CommonLoggingMonologLogger Logger with WARN priority.

Specified by:
warn in interface org.apache.commons.logging.Log

warn

public void warn(java.lang.Object message,
                 java.lang.Throwable t)
Log an error to the CommonLoggingMonologLogger Logger with WARN priority.

Specified by:
warn in interface org.apache.commons.logging.Log

error

public void error(java.lang.Object message)
Log a message to the CommonLoggingMonologLogger Logger with ERROR priority.

Specified by:
error in interface org.apache.commons.logging.Log

error

public void error(java.lang.Object message,
                  java.lang.Throwable t)
Log an error to the CommonLoggingMonologLogger Logger with ERROR priority.

Specified by:
error in interface org.apache.commons.logging.Log

fatal

public void fatal(java.lang.Object message)
Log a message to the CommonLoggingMonologLogger Logger with FATAL priority.

Specified by:
fatal in interface org.apache.commons.logging.Log

fatal

public void fatal(java.lang.Object message,
                  java.lang.Throwable t)
Log an error to the CommonLoggingMonologLogger Logger with FATAL priority.

Specified by:
fatal in interface org.apache.commons.logging.Log

getLogger

public org.objectweb.util.monolog.api.Logger getLogger()
Return the native Logger instance we are using.


isDebugEnabled

public boolean isDebugEnabled()
Check whether the CommonLoggingMonologLogger Logger used is enabled for DEBUG priority.

Specified by:
isDebugEnabled in interface org.apache.commons.logging.Log

isErrorEnabled

public boolean isErrorEnabled()
Check whether the CommonLoggingMonologLogger Logger used is enabled for ERROR priority.

Specified by:
isErrorEnabled in interface org.apache.commons.logging.Log

isFatalEnabled

public boolean isFatalEnabled()
Check whether the CommonLoggingMonologLogger Logger used is enabled for FATAL priority.

Specified by:
isFatalEnabled in interface org.apache.commons.logging.Log

isInfoEnabled

public boolean isInfoEnabled()
Check whether the CommonLoggingMonologLogger Logger used is enabled for INFO priority.

Specified by:
isInfoEnabled in interface org.apache.commons.logging.Log

isTraceEnabled

public boolean isTraceEnabled()
Check whether the CommonLoggingMonologLogger Logger used is enabled for TRACE priority. For CommonLoggingMonologLogger, this returns the value of isDebugEnabled()

Specified by:
isTraceEnabled in interface org.apache.commons.logging.Log

isWarnEnabled

public boolean isWarnEnabled()
Check whether the CommonLoggingMonologLogger Logger used is enabled for WARN priority.

Specified by:
isWarnEnabled in interface org.apache.commons.logging.Log

configure

public void configure(java.lang.String monologConfFile)
Configure the logger. All current configuration is discarded. This is a simplistic initial implementation that just allows directing to a single log file or stderr on a level basis. A more complete interface will be provided in the future.

Parameters:
logFile - The log file to write to.
fileLevels - List of levels that will be written to the file.
stderrLevels - List of levels that will be written to stderr. The same level may appear in both lists.
Throws:
java.io.IOException - If an error occurs opening the log file.

configure

public void configure()
               throws com.lutris.util.ConfigException
Default configuration of the logger. A JMX search for logger configuration file name. This file must be present in the classpath

Throws:
com.lutris.util.ConfigException

EAF 7.6 Implementation