org.apache.commons.logging.impl

Class Jdk14Logger

Implemented Interfaces:
Log, Serializable

public class Jdk14Logger
extends java.lang.Object
implements Log, Serializable

Implementation of the org.apache.commons.logging.Log interface that wraps the standard JDK logging mechanisms that were introduced in the Merlin release (JDK 1.4).
Version:
$Revision: 424107 $ $Date: 2006-07-21 01:15:42 +0200 (fr, 21 jul 2006) $
Authors:
Scott Sanders
Berin Loritsch
Peter Donald

Field Summary

protected static Level
dummyLevel
This member variable simply ensures that any attempt to initialise this class in a pre-1.4 JVM will result in an ExceptionInInitializerError.
protected Logger
logger
The underlying Logger implementation we are using.
protected String
name
The name of the logger we are wrapping.

Constructor Summary

Jdk14Logger(String name)
Construct a named instance of this Logger.

Method Summary

void
debug(Object message)
Logs a message with java.util.logging.Level.FINE.
void
debug(Object message, Throwable exception)
Logs a message with java.util.logging.Level.FINE.
void
error(Object message)
Logs a message with java.util.logging.Level.SEVERE.
void
error(Object message, Throwable exception)
Logs a message with java.util.logging.Level.SEVERE.
void
fatal(Object message)
Logs a message with java.util.logging.Level.SEVERE.
void
fatal(Object message, Throwable exception)
Logs a message with java.util.logging.Level.SEVERE.
Logger
getLogger()
Return the native Logger instance we are using.
void
info(Object message)
Logs a message with java.util.logging.Level.INFO.
void
info(Object message, Throwable exception)
Logs a message with java.util.logging.Level.INFO.
boolean
isDebugEnabled()
Is debug logging currently enabled?
boolean
isErrorEnabled()
Is error logging currently enabled?
boolean
isFatalEnabled()
Is fatal logging currently enabled?
boolean
isInfoEnabled()
Is info logging currently enabled?
boolean
isTraceEnabled()
Is trace logging currently enabled?
boolean
isWarnEnabled()
Is warn logging currently enabled?
private void
log(Level level, String msg, Throwable ex)
void
trace(Object message)
Logs a message with java.util.logging.Level.FINEST.
void
trace(Object message, Throwable exception)
Logs a message with java.util.logging.Level.FINEST.
void
warn(Object message)
Logs a message with java.util.logging.Level.WARNING.
void
warn(Object message, Throwable exception)
Logs a message with java.util.logging.Level.WARNING.

Field Details

dummyLevel

protected static final Level dummyLevel
This member variable simply ensures that any attempt to initialise this class in a pre-1.4 JVM will result in an ExceptionInInitializerError. It must not be private, as an optimising compiler could detect that it is not used and optimise it away.

logger

protected Logger logger
The underlying Logger implementation we are using.

name

protected String name
The name of the logger we are wrapping.

Constructor Details

Jdk14Logger

public Jdk14Logger(String name)
Construct a named instance of this Logger.
Parameters:
name - Name of the logger to be constructed

Method Details

debug

public void debug(Object message)
Logs a message with java.util.logging.Level.FINE.
Specified by:
debug in interface Log
Parameters:
message - to log

debug

public void debug(Object message,
                  Throwable exception)
Logs a message with java.util.logging.Level.FINE.
Specified by:
debug in interface Log
Parameters:
message - to log
exception - log this cause

error

public void error(Object message)
Logs a message with java.util.logging.Level.SEVERE.
Specified by:
error in interface Log
Parameters:
message - to log

error

public void error(Object message,
                  Throwable exception)
Logs a message with java.util.logging.Level.SEVERE.
Specified by:
error in interface Log
Parameters:
message - to log
exception - log this cause

fatal

public void fatal(Object message)
Logs a message with java.util.logging.Level.SEVERE.
Specified by:
fatal in interface Log
Parameters:
message - to log

fatal

public void fatal(Object message,
                  Throwable exception)
Logs a message with java.util.logging.Level.SEVERE.
Specified by:
fatal in interface Log
Parameters:
message - to log
exception - log this cause

getLogger

public Logger getLogger()
Return the native Logger instance we are using.

info

public void info(Object message)
Logs a message with java.util.logging.Level.INFO.
Specified by:
info in interface Log
Parameters:
message - to log

info

public void info(Object message,
                 Throwable exception)
Logs a message with java.util.logging.Level.INFO.
Specified by:
info in interface Log
Parameters:
message - to log
exception - log this cause

isDebugEnabled

public boolean isDebugEnabled()
Is debug logging currently enabled?
Specified by:
isDebugEnabled in interface Log

isErrorEnabled

public boolean isErrorEnabled()
Is error logging currently enabled?
Specified by:
isErrorEnabled in interface Log

isFatalEnabled

public boolean isFatalEnabled()
Is fatal logging currently enabled?
Specified by:
isFatalEnabled in interface Log

isInfoEnabled

public boolean isInfoEnabled()
Is info logging currently enabled?
Specified by:
isInfoEnabled in interface Log

isTraceEnabled

public boolean isTraceEnabled()
Is trace logging currently enabled?
Specified by:
isTraceEnabled in interface Log

isWarnEnabled

public boolean isWarnEnabled()
Is warn logging currently enabled?
Specified by:
isWarnEnabled in interface Log

log

private void log(Level level,
                 String msg,
                 Throwable ex)

trace

public void trace(Object message)
Logs a message with java.util.logging.Level.FINEST.
Specified by:
trace in interface Log
Parameters:
message - to log

trace

public void trace(Object message,
                  Throwable exception)
Logs a message with java.util.logging.Level.FINEST.
Specified by:
trace in interface Log
Parameters:
message - to log
exception - log this cause

warn

public void warn(Object message)
Logs a message with java.util.logging.Level.WARNING.
Specified by:
warn in interface Log
Parameters:
message - to log

warn

public void warn(Object message,
                 Throwable exception)
Logs a message with java.util.logging.Level.WARNING.
Specified by:
warn in interface Log
Parameters:
message - to log
exception - log this cause

Copyright 2002-2004 The Apache Software Foundation.