DESY ACOP Beans Home

com.cosylab.logging
Class NullLogger

java.lang.Object
  extended by java.util.logging.Logger
      extended by com.cosylab.logging.NullLogger

public final class NullLogger
extends java.util.logging.Logger

NullLogger extends Java Logger and overrides all logging methods to do nothing. Using this class statically switches all logging capabilities off, thus this method my be not callled at all by JVM optimization. Similar as sending logs to the /dev/null device.

Recomended usage is to add final Logger field to a class and use NullLogger instance when no debug information is necessary.

Since:
Jun 27, 2004.
Version:
$Id: NullLogger.java,v 1.4 2008-04-22 12:26:29 jbobnar Exp $
Author:
Igor Kriznar

Field Summary
 
Fields inherited from class java.util.logging.Logger
global, GLOBAL_LOGGER_NAME
 
Method Summary
 void addHandler(java.util.logging.Handler handler)
           
 void config(java.lang.String msg)
           
 void entering(java.lang.String sourceClass, java.lang.String sourceMethod)
           
 void entering(java.lang.String sourceClass, java.lang.String sourceMethod, java.lang.Object param1)
           
 void entering(java.lang.String sourceClass, java.lang.String sourceMethod, java.lang.Object[] params)
           
 void exiting(java.lang.String sourceClass, java.lang.String sourceMethod)
           
 void exiting(java.lang.String sourceClass, java.lang.String sourceMethod, java.lang.Object result)
           
 void fine(java.lang.String msg)
           
 void finer(java.lang.String msg)
           
 void finest(java.lang.String msg)
           
 java.util.logging.Level getLevel()
           
static NullLogger getNullLogger()
          Returns NullLogger registered at LogManager.
 boolean getUseParentHandlers()
           
 void info(java.lang.String msg)
           
 boolean isLoggable(java.util.logging.Level level)
           
 void log(java.util.logging.Level level, java.lang.String msg)
           
 void log(java.util.logging.Level level, java.lang.String msg, java.lang.Object param1)
           
 void log(java.util.logging.Level level, java.lang.String msg, java.lang.Object[] params)
           
 void log(java.util.logging.Level level, java.lang.String msg, java.lang.Throwable thrown)
           
 void log(java.util.logging.LogRecord record)
           
 void logp(java.util.logging.Level level, java.lang.String sourceClass, java.lang.String sourceMethod, java.lang.String msg)
           
 void logp(java.util.logging.Level level, java.lang.String sourceClass, java.lang.String sourceMethod, java.lang.String msg, java.lang.Object param1)
           
 void logp(java.util.logging.Level level, java.lang.String sourceClass, java.lang.String sourceMethod, java.lang.String msg, java.lang.Object[] params)
           
 void logp(java.util.logging.Level level, java.lang.String sourceClass, java.lang.String sourceMethod, java.lang.String msg, java.lang.Throwable thrown)
           
 void logrb(java.util.logging.Level level, java.lang.String sourceClass, java.lang.String sourceMethod, java.lang.String bundleName, java.lang.String msg)
           
 void logrb(java.util.logging.Level level, java.lang.String sourceClass, java.lang.String sourceMethod, java.lang.String bundleName, java.lang.String msg, java.lang.Object param1)
           
 void logrb(java.util.logging.Level level, java.lang.String sourceClass, java.lang.String sourceMethod, java.lang.String bundleName, java.lang.String msg, java.lang.Object[] params)
           
 void logrb(java.util.logging.Level level, java.lang.String sourceClass, java.lang.String sourceMethod, java.lang.String bundleName, java.lang.String msg, java.lang.Throwable thrown)
           
 void setLevel(java.util.logging.Level newLevel)
           
 void setUseParentHandlers(boolean useParentHandlers)
           
 void severe(java.lang.String msg)
           
 void throwing(java.lang.String sourceClass, java.lang.String sourceMethod, java.lang.Throwable thrown)
           
 void warning(java.lang.String msg)
           
 
Methods inherited from class java.util.logging.Logger
getAnonymousLogger, getAnonymousLogger, getFilter, getHandlers, getLogger, getLogger, getName, getParent, getResourceBundle, getResourceBundleName, removeHandler, setFilter, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getNullLogger

public static final NullLogger getNullLogger()
Returns NullLogger registered at LogManager. IF Log manager does not have NullLogger, new one is created, registered at LogManager and returned.

Returns:
NullLogger instance registered at LogManager

addHandler

public void addHandler(java.util.logging.Handler handler)
                throws java.lang.SecurityException
Overrides:
addHandler in class java.util.logging.Logger
Throws:
java.lang.SecurityException

config

public void config(java.lang.String msg)
Overrides:
config in class java.util.logging.Logger

entering

public void entering(java.lang.String sourceClass,
                     java.lang.String sourceMethod)
Overrides:
entering in class java.util.logging.Logger

entering

public void entering(java.lang.String sourceClass,
                     java.lang.String sourceMethod,
                     java.lang.Object param1)
Overrides:
entering in class java.util.logging.Logger

entering

public void entering(java.lang.String sourceClass,
                     java.lang.String sourceMethod,
                     java.lang.Object[] params)
Overrides:
entering in class java.util.logging.Logger

exiting

public void exiting(java.lang.String sourceClass,
                    java.lang.String sourceMethod)
Overrides:
exiting in class java.util.logging.Logger

fine

public void fine(java.lang.String msg)
Overrides:
fine in class java.util.logging.Logger

exiting

public void exiting(java.lang.String sourceClass,
                    java.lang.String sourceMethod,
                    java.lang.Object result)
Overrides:
exiting in class java.util.logging.Logger

finer

public void finer(java.lang.String msg)
Overrides:
finer in class java.util.logging.Logger

finest

public void finest(java.lang.String msg)
Overrides:
finest in class java.util.logging.Logger

info

public void info(java.lang.String msg)
Overrides:
info in class java.util.logging.Logger

isLoggable

public boolean isLoggable(java.util.logging.Level level)
Overrides:
isLoggable in class java.util.logging.Logger

log

public void log(java.util.logging.Level level,
                java.lang.String msg)
Overrides:
log in class java.util.logging.Logger

log

public void log(java.util.logging.Level level,
                java.lang.String msg,
                java.lang.Object param1)
Overrides:
log in class java.util.logging.Logger

log

public void log(java.util.logging.Level level,
                java.lang.String msg,
                java.lang.Object[] params)
Overrides:
log in class java.util.logging.Logger

log

public void log(java.util.logging.Level level,
                java.lang.String msg,
                java.lang.Throwable thrown)
Overrides:
log in class java.util.logging.Logger

log

public void log(java.util.logging.LogRecord record)
Overrides:
log in class java.util.logging.Logger

logp

public void logp(java.util.logging.Level level,
                 java.lang.String sourceClass,
                 java.lang.String sourceMethod,
                 java.lang.String msg)
Overrides:
logp in class java.util.logging.Logger

logp

public void logp(java.util.logging.Level level,
                 java.lang.String sourceClass,
                 java.lang.String sourceMethod,
                 java.lang.String msg,
                 java.lang.Object param1)
Overrides:
logp in class java.util.logging.Logger

logp

public void logp(java.util.logging.Level level,
                 java.lang.String sourceClass,
                 java.lang.String sourceMethod,
                 java.lang.String msg,
                 java.lang.Object[] params)
Overrides:
logp in class java.util.logging.Logger

logp

public void logp(java.util.logging.Level level,
                 java.lang.String sourceClass,
                 java.lang.String sourceMethod,
                 java.lang.String msg,
                 java.lang.Throwable thrown)
Overrides:
logp in class java.util.logging.Logger

logrb

public void logrb(java.util.logging.Level level,
                  java.lang.String sourceClass,
                  java.lang.String sourceMethod,
                  java.lang.String bundleName,
                  java.lang.String msg)
Overrides:
logrb in class java.util.logging.Logger

logrb

public void logrb(java.util.logging.Level level,
                  java.lang.String sourceClass,
                  java.lang.String sourceMethod,
                  java.lang.String bundleName,
                  java.lang.String msg,
                  java.lang.Object param1)
Overrides:
logrb in class java.util.logging.Logger

logrb

public void logrb(java.util.logging.Level level,
                  java.lang.String sourceClass,
                  java.lang.String sourceMethod,
                  java.lang.String bundleName,
                  java.lang.String msg,
                  java.lang.Object[] params)
Overrides:
logrb in class java.util.logging.Logger

logrb

public void logrb(java.util.logging.Level level,
                  java.lang.String sourceClass,
                  java.lang.String sourceMethod,
                  java.lang.String bundleName,
                  java.lang.String msg,
                  java.lang.Throwable thrown)
Overrides:
logrb in class java.util.logging.Logger

setLevel

public void setLevel(java.util.logging.Level newLevel)
              throws java.lang.SecurityException
Overrides:
setLevel in class java.util.logging.Logger
Throws:
java.lang.SecurityException

getLevel

public java.util.logging.Level getLevel()
Overrides:
getLevel in class java.util.logging.Logger

severe

public void severe(java.lang.String msg)
Overrides:
severe in class java.util.logging.Logger

throwing

public void throwing(java.lang.String sourceClass,
                     java.lang.String sourceMethod,
                     java.lang.Throwable thrown)
Overrides:
throwing in class java.util.logging.Logger

getUseParentHandlers

public boolean getUseParentHandlers()
Overrides:
getUseParentHandlers in class java.util.logging.Logger

setUseParentHandlers

public void setUseParentHandlers(boolean useParentHandlers)
Overrides:
setUseParentHandlers in class java.util.logging.Logger

warning

public void warning(java.lang.String msg)
Overrides:
warning in class java.util.logging.Logger


Copyright © 2010. All Rights Reserved.