org.jwarp.service.log
Class LogWriter

java.lang.Object
  |
  +--org.jwarp.service.log.LogWriter
All Implemented Interfaces:
IConfigurable, ILogWriter

public class LogWriter
extends java.lang.Object
implements ILogWriter

Class to write an application log

Version:
1.0
Author:
Anatole Tresch, Martin Schaefer

Field Summary
(package private)  int logLevel
          The currently active log level.
 
Fields inherited from interface org.jwarp.service.log.ILogWriter
LOG_LEVEL_ALL, LOG_LEVEL_DEBUG, LOG_LEVEL_ERROR, LOG_LEVEL_FATAL_ERROR, LOG_LEVEL_INFO, LOG_LEVEL_NONE, LOG_LEVEL_UNKNOWN, LOG_LEVEL_WARNING
 
Constructor Summary
LogWriter()
          Creates a new LogWriter
LogWriter(java.lang.String name)
          Creates a logwriter with the given name.
 
Method Summary
 void addLogListener(ILogListener listener)
          Add a new LogWriter
 void configure(org.jdom.Element config)
          Creates a logwriter with the given config.
 int getLogLevel()
          Returns the current active log level.
 java.lang.String getLogName()
          Return the log's name
 void log(java.lang.Exception exception)
          Log an exception.
 void log(java.lang.Exception exception, int logLevel)
          Log an exception.
 void log(LogEvent event)
          Log an event
 void log(java.lang.String message, int logLevel)
          Log an message
 void logDebug(java.lang.String message)
          Log a message.
 void logError(java.lang.String message)
          Log a message.
 void logInformation(java.lang.String message)
          Log a message.
 void logWarning(java.lang.String message)
          Log a message.
 void removeAllLogListeners()
          Removes all log listeners
 void setLogLevel(int level)
          Set the current log level.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logLevel

int logLevel
The currently active log level. As default this is set to LOG_LEVEL_ALL, so the listeners can decide on how or what to handle.
Constructor Detail

LogWriter

public LogWriter()
Creates a new LogWriter

LogWriter

public LogWriter(java.lang.String name)
Creates a logwriter with the given name.
Method Detail

configure

public void configure(org.jdom.Element config)
               throws ConfigurationException
Creates a logwriter with the given config.
Specified by:
configure in interface IConfigurable
Following copied from interface: org.jwarp.service.configuration.IConfigurable
Parameters:
configuration - the class configurations.

getLogName

public java.lang.String getLogName()
Return the log's name
Specified by:
getLogName in interface ILogWriter
Returns:
The name

addLogListener

public void addLogListener(ILogListener listener)
Add a new LogWriter
Specified by:
addLogListener in interface ILogWriter
Parameters:
listener - The listener to add
logLevel - Log-level to start with

removeAllLogListeners

public void removeAllLogListeners()
Removes all log listeners
Specified by:
removeAllLogListeners in interface ILogWriter

log

public void log(LogEvent event)
Log an event
Specified by:
log in interface ILogWriter
Parameters:
event - The event to log

log

public void log(java.lang.String message,
                int logLevel)
Log an message
Specified by:
log in interface ILogWriter
Parameters:
message - Message for the log
logLevel - log level of the message

log

public void log(java.lang.Exception exception,
                int logLevel)
Log an exception.
Specified by:
log in interface ILogWriter
Parameters:
exception - The exception to log
logLevel - log level of the exception

log

public void log(java.lang.Exception exception)
Log an exception. The exception will be logged as error
Specified by:
log in interface ILogWriter
Parameters:
exception - The exception to log

logInformation

public void logInformation(java.lang.String message)
Log a message. The message will be logged as information
Specified by:
logInformation in interface ILogWriter
Parameters:
message - The message to log

logWarning

public void logWarning(java.lang.String message)
Log a message. The message will be logged as warning
Specified by:
logWarning in interface ILogWriter
Parameters:
message - The message to log

logError

public void logError(java.lang.String message)
Log a message. The message will be logged as error
Specified by:
logError in interface ILogWriter
Parameters:
message - The message to log

logDebug

public void logDebug(java.lang.String message)
Log a message. The message will be logged as debug information
Specified by:
logDebug in interface ILogWriter
Parameters:
message - The message to log

getLogLevel

public int getLogLevel()
Returns the current active log level.
Specified by:
getLogLevel in interface ILogWriter
Returns:
The current log level.

setLogLevel

public void setLogLevel(int level)
Set the current log level.
Specified by:
setLogLevel in interface ILogWriter
Parameters:
level - The new log level

©   O R C A   S y s t e m s