com.iparelan.util
Class UtilLogger

java.lang.Object
  extended by com.iparelan.util.UtilLogger
All Implemented Interfaces:
Logger

@Singleton
@Copyright(value="Copyright © 2008, Iparelan Solutions, LLC. All rights reserved.")
final class UtilLogger
extends Object
implements Logger

A specialized Logger that can log messages before a logging service has been started. This Logger writes log messages to the standard error stream.

The isLoggable*() predicates always produce true because this logger is not configurable.

The system property SILENCE_PROPERTY_NAME can be used to elide all output from this logger. Its default value is SILENCE_PROPERTY_DEFAULT.

Version:
July 2008
Author:
Greg Mattes

Nested Class Summary
private static class UtilLogger.LoggerHolder
           
 
Field Summary
private static AtomicBoolean enforceSingletonDynamically
           
private static boolean SILENCE
           
static String SILENCE_PROPERTY_DEFAULT
           
static String SILENCE_PROPERTY_NAME
           
 
Constructor Summary
private UtilLogger()
          Not externally instantiable.
 
Method Summary
 void config(String msg)
          Logs a message at the config level.
 void config(String msg, Throwable throwable)
          Logs a message at the config level.
 void fine(String msg)
          Logs a message at the fine level.
 void fine(String msg, Throwable throwable)
          Logs a message at the fine level.
 void finer(String msg)
          Logs a message at the finer level.
 void finer(String msg, Throwable throwable)
          Logs a message at the finer level.
 void finest(String msg)
          Logs a message at the finest level.
 void finest(String msg, Throwable throwable)
          Logs a message at the finest level.
(package private) static Logger getLogger()
          Produces the singleton instance.
 void info(String msg)
          Logs a message at the info level.
 void info(String msg, Throwable throwable)
          Logs a message at the info level.
 boolean isLoggableConfig()
          Tells whether messages at the config level will be logged.
 boolean isLoggableFine()
          Tells whether messages at the fine level will be logged.
 boolean isLoggableFiner()
          Tells whether messages at the finer level will be logged.
 boolean isLoggableFinest()
          Tells whether messages at the finest level will be logged.
 boolean isLoggableInfo()
          Tells whether messages at the info level will be logged.
 boolean isLoggableSevere()
          Tells whether messages at the severe level will be logged.
 boolean isLoggableWarning()
          Tells whether messages at the warning level will be logged.
private  void log(String msg)
          Emits msg to the standard error stream.
private  void log(String msg, Throwable throwable)
          Emits msg and throwable to the standard error stream.
 void severe(String msg)
          Logs a message at the severe level.
 void severe(String msg, Throwable throwable)
          Logs a message at the severe level.
 void warning(String msg)
          Logs a message at the warning level.
 void warning(String msg, Throwable throwable)
          Logs a message at the warning level.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

enforceSingletonDynamically

private static final AtomicBoolean enforceSingletonDynamically

SILENCE_PROPERTY_NAME

public static final String SILENCE_PROPERTY_NAME
See Also:
Constant Field Values

SILENCE_PROPERTY_DEFAULT

public static final String SILENCE_PROPERTY_DEFAULT

SILENCE

private static final boolean SILENCE
Constructor Detail

UtilLogger

private UtilLogger()
Not externally instantiable.

Method Detail

getLogger

static Logger getLogger()
Produces the singleton instance.

Returns:
The singleton instance. Never null.

config

public void config(String msg)
Description copied from interface: Logger
Logs a message at the config level.

Specified by:
config in interface Logger
Parameters:
msg - The log message. May not be null.

config

public void config(String msg,
                   Throwable throwable)
Description copied from interface: Logger
Logs a message at the config level.

Specified by:
config in interface Logger
Parameters:
msg - The log message. May not be null.
throwable - The throwable associated with the log message. May not be null.

fine

public void fine(String msg)
Description copied from interface: Logger
Logs a message at the fine level.

Specified by:
fine in interface Logger
Parameters:
msg - The log message. May not be null.

fine

public void fine(String msg,
                 Throwable throwable)
Description copied from interface: Logger
Logs a message at the fine level.

Specified by:
fine in interface Logger
Parameters:
msg - The log message. May not be null.
throwable - The throwable associated with the log message. May not be null.

finer

public void finer(String msg)
Description copied from interface: Logger
Logs a message at the finer level.

Specified by:
finer in interface Logger
Parameters:
msg - The log message. May not be null.

finer

public void finer(String msg,
                  Throwable throwable)
Description copied from interface: Logger
Logs a message at the finer level.

Specified by:
finer in interface Logger
Parameters:
msg - The log message. May not be null.
throwable - The throwable associated with the log message. May not be null.

finest

public void finest(String msg)
Description copied from interface: Logger
Logs a message at the finest level.

Specified by:
finest in interface Logger
Parameters:
msg - The log message. May not be null.

finest

public void finest(String msg,
                   Throwable throwable)
Description copied from interface: Logger
Logs a message at the finest level.

Specified by:
finest in interface Logger
Parameters:
msg - The log message. May not be null.
throwable - The throwable associated with the log message. May not be null.

info

public void info(String msg)
Description copied from interface: Logger
Logs a message at the info level.

Specified by:
info in interface Logger
Parameters:
msg - The log message. May not be null.

info

public void info(String msg,
                 Throwable throwable)
Description copied from interface: Logger
Logs a message at the info level.

Specified by:
info in interface Logger
Parameters:
msg - The log message. May not be null.
throwable - The throwable associated with the log message. May not be null.

severe

public void severe(String msg)
Description copied from interface: Logger
Logs a message at the severe level.

Specified by:
severe in interface Logger
Parameters:
msg - The log message. May not be null.

severe

public void severe(String msg,
                   Throwable throwable)
Description copied from interface: Logger
Logs a message at the severe level.

Specified by:
severe in interface Logger
Parameters:
msg - The log message. May not be null.
throwable - The throwable associated with the log message. May not be null.

warning

public void warning(String msg)
Description copied from interface: Logger
Logs a message at the warning level.

Specified by:
warning in interface Logger
Parameters:
msg - The log message. May not be null.

warning

public void warning(String msg,
                    Throwable throwable)
Description copied from interface: Logger
Logs a message at the warning level.

Specified by:
warning in interface Logger
Parameters:
msg - The log message. May not be null.
throwable - The throwable associated with the log message. May not be null.

isLoggableConfig

public boolean isLoggableConfig()
Description copied from interface: Logger
Tells whether messages at the config level will be logged.

Specified by:
isLoggableConfig in interface Logger
Returns:
true if messages will be logged at the config level, otherwise false.

isLoggableFine

public boolean isLoggableFine()
Description copied from interface: Logger
Tells whether messages at the fine level will be logged.

Specified by:
isLoggableFine in interface Logger
Returns:
true if messages will be logged at the fine level, otherwise false.

isLoggableFiner

public boolean isLoggableFiner()
Description copied from interface: Logger
Tells whether messages at the finer level will be logged.

Specified by:
isLoggableFiner in interface Logger
Returns:
true if messages will be logged at the finer level, otherwise false.

isLoggableFinest

public boolean isLoggableFinest()
Description copied from interface: Logger
Tells whether messages at the finest level will be logged.

Specified by:
isLoggableFinest in interface Logger
Returns:
true if messages will be logged at the finest level, otherwise false.

isLoggableInfo

public boolean isLoggableInfo()
Description copied from interface: Logger
Tells whether messages at the info level will be logged.

Specified by:
isLoggableInfo in interface Logger
Returns:
true if messages will be logged at the info level, otherwise false.

isLoggableSevere

public boolean isLoggableSevere()
Description copied from interface: Logger
Tells whether messages at the severe level will be logged.

Specified by:
isLoggableSevere in interface Logger
Returns:
true if messages will be logged at the severe level, otherwise false.

isLoggableWarning

public boolean isLoggableWarning()
Description copied from interface: Logger
Tells whether messages at the warning level will be logged.

Specified by:
isLoggableWarning in interface Logger
Returns:
true if messages will be logged at the warning level, otherwise false.

log

private void log(String msg)
Emits msg to the standard error stream.

Parameters:
msg - The message to send to the standard error stream. May not be null.

log

private void log(String msg,
                 Throwable throwable)
Emits msg and throwable to the standard error stream.

Parameters:
msg - The message to send to the standard error stream. May not be null.
throwable - The Throwable associated with msg. May not be null.


Copyright © 2008 Iparelan Solutions, LLC. All rights reserved.