deegree 2.3 (2010/04/09 10:10 build-4-official)

org.deegree.framework.log
Class LoggerService

java.lang.Object
  extended by org.deegree.framework.log.LoggerService
All Implemented Interfaces:
ILogger
Direct Known Subclasses:
JCLLogger

abstract class LoggerService
extends Object
implements ILogger

The Logger is used to log messages to files. This service will use a logging service provided by the application server or a 3rd party logging service such as Apache Log4J to enable asychronous call of the method log(). The log server is configured by a set of Properties which are provided to the class init.

There are some global properties as well:

Messages are logged using log(). If an error occurs during creation or logging, the message will be written to the server BootLogger.

Version:
$Revision: 18195 $, $Date: 2009-06-18 17:55:39 +0200 (Do, 18. Jun 2009) $
Author:
Torsten Friebe , last edited by: UID=$Author: mschneider $
See Also:
LoggerFactory, BootLogger

Field Summary
protected static String defaultChannelName
          the log channel name
 
Fields inherited from interface org.deegree.framework.log.ILogger
LOG_DEBUG, LOG_ERROR, LOG_INFO, LOG_WARNING
 
Constructor Summary
protected LoggerService()
          Create logger instance
 
Method Summary
 void init(Properties props)
           
abstract  void logDebug(String message)
          Log debug message
abstract  void logDebug(String message, Throwable e)
          Log debug message.
 void logDebugBinaryFile(File file, byte[] data)
          Logs the given binary data to the specified file if log level is set to LOG_DEBUG.
 void logDebugBinaryFile(String filePrefix, String fileSuffix, byte[] data)
          Logs the given binary data to a temporary file (created from specified prefix and suffix) if log level is set to LOG_DEBUG.
 void logDebugFile(File file, String content)
          Logs the given text to the specified file if log level is set to LOG_DEBUG.
 void logDebugFile(String filePrefix, String fileSuffix, String content)
          Logs the given text to a temporary file (created from specified prefix and suffix) if log level is set to LOG_DEBUG.
 void logDebugXMLFile(String filePrefix, XMLFragment fragment)
          Logs the given XMLFragment to a temporary file (created from specified prefix and suffix ".xml") if log level is set to LOG_DEBUG.
 void logError(String message, Throwable e, Map<?,?> properties)
          Log error with exception
abstract  void logInfo(String message)
          Log info message
abstract  void logInfo(String message, Throwable e)
          Log info message
abstract  void logWarning(String message)
          Log warning message
abstract  void logWarning(String message, Throwable e)
          Log warning message with exception
protected  void sendMail(String message, Throwable ex, Map<?,?> properties)
          Sends email with exception string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.deegree.framework.log.ILogger
bindClass, bindClass, getLevel, isDebug, log, log, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, setLevel
 

Field Detail

defaultChannelName

protected static String defaultChannelName
the log channel name

Constructor Detail

LoggerService

protected LoggerService()
Create logger instance

Method Detail

init

public void init(Properties props)
Specified by:
init in interface ILogger

logError

public final void logError(String message,
                           Throwable e,
                           Map<?,?> properties)
Log error with exception

Parameters:
message - the log message
e - the exception to be logged
properties - a given Property file in which specific email notification possibilities are saved.

logWarning

public abstract void logWarning(String message)
Log warning message

Specified by:
logWarning in interface ILogger
Parameters:
message - the log message

logWarning

public abstract void logWarning(String message,
                                Throwable e)
Log warning message with exception

Specified by:
logWarning in interface ILogger
Parameters:
message - the log message
e - the exception to be logged

logInfo

public abstract void logInfo(String message)
Log info message

Specified by:
logInfo in interface ILogger
Parameters:
message - the log message

logInfo

public abstract void logInfo(String message,
                             Throwable e)
Log info message

Specified by:
logInfo in interface ILogger
Parameters:
message - the log message
e - the exception to be logged

logDebug

public abstract void logDebug(String message)
Log debug message

Specified by:
logDebug in interface ILogger
Parameters:
message - the log message

logDebug

public abstract void logDebug(String message,
                              Throwable e)
Log debug message.

Specified by:
logDebug in interface ILogger
Parameters:
message - the log message
e - the exception to be logged

logDebugFile

public void logDebugFile(File file,
                         String content)
Logs the given text to the specified file if log level is set to LOG_DEBUG.

Specified by:
logDebugFile in interface ILogger
Parameters:
file - file to log to
content - text to be logged

logDebugFile

public void logDebugFile(String filePrefix,
                         String fileSuffix,
                         String content)
Logs the given text to a temporary file (created from specified prefix and suffix) if log level is set to LOG_DEBUG.

Specified by:
logDebugFile in interface ILogger
Parameters:
filePrefix - prefix for the temp file name
fileSuffix - suffix for the temp file name, can be null (then ".tmp" is used)
content - text to be logged
See Also:
File.createTempFile(String, String)

logDebugXMLFile

public void logDebugXMLFile(String filePrefix,
                            XMLFragment fragment)
Logs the given XMLFragment to a temporary file (created from specified prefix and suffix ".xml") if log level is set to LOG_DEBUG.

Specified by:
logDebugXMLFile in interface ILogger
Parameters:
filePrefix - prefix for the temp file name
fragment - XMLFragment to be logged (will be pretty-printed)

logDebugBinaryFile

public void logDebugBinaryFile(File file,
                               byte[] data)
Logs the given binary data to the specified file if log level is set to LOG_DEBUG.

Specified by:
logDebugBinaryFile in interface ILogger
Parameters:
file - file to log to
data - binary data to be logged

logDebugBinaryFile

public void logDebugBinaryFile(String filePrefix,
                               String fileSuffix,
                               byte[] data)
Logs the given binary data to a temporary file (created from specified prefix and suffix) if log level is set to LOG_DEBUG.

Specified by:
logDebugBinaryFile in interface ILogger
Parameters:
filePrefix - prefix for the temp file name
fileSuffix - suffix for the temp file name, can be null (then ".tmp" is used)
data - binary data to be logged
See Also:
File.createTempFile(String, String)

sendMail

protected void sendMail(String message,
                        Throwable ex,
                        Map<?,?> properties)
Sends email with exception string. If mail session or mail notification address is null no email is send.

Parameters:
message - message is in mail subject
ex - full exception is displayed in body
properties - list of properties listed in body

deegree 2.3 (2010/04/09 10:10 build-4-official)

an open source project founded by lat/lon, Bonn, Germany.
For more information visit: http://www.deegree.org