Nuxeo Enterprise Platform 5.3

com.anwrt.ooserver.daemon
Class Logger

java.lang.Object
  extended by com.anwrt.ooserver.daemon.Logger
Direct Known Subclasses:
Log4JLogger, LoggerBasicImpl

public abstract class Logger
extends Object

Static class.
The logger is used by calling Logger's static methods such as info, debug, etc...

WARNING You must first instantiate a Logger,
Logger.newInstance(new LoggerBasicImpl()); for example.
Other loggers can be created using LoggerBasicImpl as an example.

Author:
Jounayd Id Salah

Field Summary
static int DEBUG
           
static int DETAILED_DEBUG
           
static int ERROR
           
static int INFO
           
protected static int level
           
static String[] levelStrings
           
static int NB_LEVELS
           
static int NONE
           
static int WARNING
           
 
Constructor Summary
Logger()
           
 
Method Summary
static void debug(Exception ex)
           
static void debug(String msg)
           
static void debug(String msg, Exception ex)
           
protected abstract  void debugImpl(Exception ex)
           
protected abstract  void debugImpl(String msg)
           
protected abstract  void debugImpl(String msg, Exception ex)
           
static void detailedDebug(Exception ex)
           
protected abstract  void detailedDebugImpl(Exception ex)
           
static void error(String msg)
           
protected abstract  void errorImpl(String msg)
           
static void fatalError(String msg)
           
static void fatalError(String msg, Exception ex)
           
protected abstract  void fatalErrorImpl(String msg)
           
protected abstract  void fatalErrorImpl(String msg, Exception ex)
           
static Logger getInstance()
          Returns the current Logger instance.
static int getLevel()
          Returns log level
static void info(String msg)
           
protected abstract  void infoImpl(String msg)
           
static String levelInformation(String prefixTabs)
          Returns informations about logging levels
 String levelToString()
          Converts the current level to String
static void newInstance(Logger instance)
          Used to specify which instance will be used by the static methods of the Logger.
static void setLevel(int lvl)
          Used to set the log level.
static void setLevel(String lvlStr)
          Used to set the log level.
 String toString()
          displays logger's level
static void warning(String msg)
           
protected abstract  void warningImpl(String msg)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NONE

public static final int NONE
See Also:
Constant Field Values

ERROR

public static final int ERROR
See Also:
Constant Field Values

INFO

public static final int INFO
See Also:
Constant Field Values

WARNING

public static final int WARNING
See Also:
Constant Field Values

DEBUG

public static final int DEBUG
See Also:
Constant Field Values

DETAILED_DEBUG

public static final int DETAILED_DEBUG
See Also:
Constant Field Values

NB_LEVELS

public static final int NB_LEVELS
See Also:
Constant Field Values

levelStrings

public static final String[] levelStrings

level

protected static int level
Constructor Detail

Logger

public Logger()
Method Detail

newInstance

public static void newInstance(Logger instance)
Used to specify which instance will be used by the static methods of the Logger.

Parameters:
instance - a child of the abstract class Logger (ex : LoggerBasicImpl)

getInstance

public static Logger getInstance()
Returns the current Logger instance.

Returns:
current instance

setLevel

public static void setLevel(int lvl)
                     throws IncorrectLoggerLevelException
Used to set the log level. An logger instance is not needed, all this is static.

Parameters:
lvl - level such as INFO, WARNING, DEBUG, ...
Throws:
IncorrectLoggerLevelException - level passed as an argument is not valid

setLevel

public static void setLevel(String lvlStr)
                     throws IncorrectLoggerLevelException
Used to set the log level. An logger instance is not needed, all this is static.

Parameters:
lvlStr - level such as INFO, WARNING, DEBUG, ...
Throws:
IncorrectLoggerLevelException - level passed as an argument is not valid

levelToString

public String levelToString()
Converts the current level to String

Returns:
level as a string

getLevel

public static int getLevel()
Returns log level

Returns:
log level

infoImpl

protected abstract void infoImpl(String msg)

info

public static void info(String msg)

warningImpl

protected abstract void warningImpl(String msg)

warning

public static void warning(String msg)

debugImpl

protected abstract void debugImpl(String msg)

debug

public static void debug(String msg)

debugImpl

protected abstract void debugImpl(String msg,
                                  Exception ex)

debug

public static void debug(String msg,
                         Exception ex)

debugImpl

protected abstract void debugImpl(Exception ex)

debug

public static void debug(Exception ex)

detailedDebugImpl

protected abstract void detailedDebugImpl(Exception ex)

detailedDebug

public static void detailedDebug(Exception ex)

errorImpl

protected abstract void errorImpl(String msg)

error

public static void error(String msg)

fatalErrorImpl

protected abstract void fatalErrorImpl(String msg)

fatalError

public static void fatalError(String msg)

fatalErrorImpl

protected abstract void fatalErrorImpl(String msg,
                                       Exception ex)

fatalError

public static void fatalError(String msg,
                              Exception ex)

toString

public String toString()
displays logger's level

Overrides:
toString in class Object
Returns:
-
See Also:
Object.toString()

levelInformation

public static String levelInformation(String prefixTabs)
Returns informations about logging levels

Parameters:
prefixTabs - optional tabs that will be written before displaying a line for indentation
Returns:
a string containing a list of levels with their description

Nuxeo Enterprise Platform 5.3

Copyright © 2010 Nuxeo SAS. All Rights Reserved.