org.webdocwf.util.loader.logging
Class StandardLogger

java.lang.Object
  extended by org.webdocwf.util.loader.logging.Logger
      extended by org.webdocwf.util.loader.logging.StandardLogger

public class StandardLogger
extends Logger

Standard implementation of the Logger. This is general-purpose logging facility. A client that needs additional functionality can either extend this class or provide there own implementationm of Logger.

Currently this is a bare-bones class that writes INFO and above levels to stderr and all others to a log file.

Author:
Sinisa Milosevic
See Also:
Logger

Field Summary
 java.io.RandomAccessFile randomLoggerFile
           
 
Fields inherited from class org.webdocwf.util.loader.logging.Logger
centralLogger, enbledLogLevels, LOGMODE_FULL, LOGMODE_NONE, LOGMODE_NORMAL, standardLevelNames, strLOGMODE_FULL, strLOGMODE_NONE, strLOGMODE_NORMAL
 
Constructor Summary
StandardLogger()
          Construct a new logger.
 
Method Summary
 void close()
           
 void configure(java.lang.String confFilePath)
          Configure Logger with given config file, interpreting of config file is logger implementation specific.
 boolean[] getEnabledLogLevels()
           
 int getLevel(java.lang.String level)
          Convert a symbolic level to an integer identifier.
 java.lang.String getMessage(java.lang.String key)
           
 boolean isEnabled(int level)
          Determine if logging is enabled for the specified level.
 boolean isEnabled(java.lang.String level)
          Determine if logging is enabled for the specified level.
 void setEnabledLogLevels(java.lang.String logMode)
           
 boolean setMessage(java.lang.String key, java.lang.String value)
           
 void write(int level, java.lang.String msg)
          Write a string to the log file.
 void write(int level, java.lang.String msg, java.lang.Throwable throwable)
          Write a string and exception to the log file.
 void write(java.lang.String level, java.lang.String msg)
          Write a string to the log file.
 void write(java.lang.String level, java.lang.String msg, java.lang.Throwable throwable)
          Write a string and exception to the log file.
 boolean writeEcho(java.lang.String strLogTxt)
           
 
Methods inherited from class org.webdocwf.util.loader.logging.Logger
getCentralLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

randomLoggerFile

public java.io.RandomAccessFile randomLoggerFile
Constructor Detail

StandardLogger

public StandardLogger()
Construct a new logger. Configuration is not done now, to allow the logger to be created very early.

Method Detail

configure

public void configure(java.lang.String confFilePath)
               throws java.lang.Exception
Configure Logger with given config file, interpreting of config file is logger implementation specific.

Specified by:
configure in class Logger
Parameters:
confFilePath - Path to configuration file.
Throws:
java.lang.Exception

getLevel

public int getLevel(java.lang.String level)
Description copied from class: Logger
Convert a symbolic level to an integer identifier.

Specified by:
getLevel in class Logger
Parameters:
level - Symbolic level to convert
Returns:
The numeric level identifier

isEnabled

public boolean isEnabled(int level)
Description copied from class: Logger
Determine if logging is enabled for the specified level. This is useful to prevent a series of unnecessary logging calls, as often encountered with debug logging, or a call where generating the message is expensive.

Specified by:
isEnabled in class Logger
Parameters:
level - Numeric level that is to be checked.
Returns:
true if enabled, false if not enabled.

isEnabled

public boolean isEnabled(java.lang.String level)
Description copied from class: Logger
Determine if logging is enabled for the specified level. This is useful to prevent a series of unnecessary logging calls, as often encountered with debug logging, or a call where generating the message is expensive.

Specified by:
isEnabled in class Logger
Parameters:
level - Symbolic level that is to be checked.
Returns:
true if enabled, false if not enabled.

write

public void write(int level,
                  java.lang.String msg)
Description copied from class: Logger
Write a string to the log file.

Specified by:
write in class Logger
Parameters:
level - Numeric level the message is associated with.
msg - The message to log.

write

public void write(java.lang.String level,
                  java.lang.String msg)
Description copied from class: Logger
Write a string to the log file.

Specified by:
write in class Logger
Parameters:
level - Symbolic level the message is associated with.
msg - The message to log.

write

public void write(int level,
                  java.lang.String msg,
                  java.lang.Throwable throwable)
Description copied from class: Logger
Write a string and exception to the log file.

Specified by:
write in class Logger
Parameters:
level - Numeric level the message is associated with.
msg - The message to log.
throwable - Exception or error to log.

write

public void write(java.lang.String level,
                  java.lang.String msg,
                  java.lang.Throwable throwable)
Description copied from class: Logger
Write a string and exception to the log file.

Specified by:
write in class Logger
Parameters:
level - Symbolic level the message is associated with.
msg - The message to log.
throwable - Exception or error to log.

setEnabledLogLevels

public void setEnabledLogLevels(java.lang.String logMode)
Specified by:
setEnabledLogLevels in class Logger

getEnabledLogLevels

public boolean[] getEnabledLogLevels()
Specified by:
getEnabledLogLevels in class Logger

getMessage

public java.lang.String getMessage(java.lang.String key)
Specified by:
getMessage in class Logger

setMessage

public boolean setMessage(java.lang.String key,
                          java.lang.String value)
Specified by:
setMessage in class Logger

writeEcho

public boolean writeEcho(java.lang.String strLogTxt)
Specified by:
writeEcho in class Logger

close

public void close()
Specified by:
close in class Logger


Copyright © 2002-2007 Together - the Workgroup. All Rights Reserved.