deegree 2.5 (2011/06/29 09:44 build-8-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 java.lang.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 java.lang.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(java.util.Properties props)
           
abstract  void logDebug(java.lang.String message)
          Log debug message
abstract  void logDebug(java.lang.String message, java.lang.Throwable e)
          Log debug message.
 void logDebugBinaryFile(java.io.File file, byte[] data)
          Logs the given binary data to the specified file if log level is set to LOG_DEBUG.
 void logDebugBinaryFile(java.lang.String filePrefix, java.lang.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(java.io.File file, java.lang.String content)
          Logs the given text to the specified file if log level is set to LOG_DEBUG.
 void logDebugFile(java.lang.String filePrefix, java.lang.String fileSuffix, java.lang.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(java.lang.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(java.lang.String message, java.lang.Throwable e, java.util.Map<?,?> properties)
          Log error with exception
abstract  void logInfo(java.lang.String message)
          Log info message
abstract  void logInfo(java.lang.String message, java.lang.Throwable e)
          Log info message
abstract  void logWarning(java.lang.String message)
          Log warning message
abstract  void logWarning(java.lang.String message, java.lang.Throwable e)
          Log warning message with exception
protected  void sendMail(java.lang.String message, java.lang.Throwable ex, java.util.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 java.lang.String defaultChannelName
the log channel name

Constructor Detail

LoggerService

protected LoggerService()
Create logger instance

Method Detail

init

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

logError

public final void logError(java.lang.String message,
                           java.lang.Throwable e,
                           java.util.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(java.lang.String message)
Log warning message

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

logWarning

public abstract void logWarning(java.lang.String message,
                                java.lang.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(java.lang.String message)
Log info message

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

logInfo

public abstract void logInfo(java.lang.String message,
                             java.lang.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(java.lang.String message)
Log debug message

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

logDebug

public abstract void logDebug(java.lang.String message,
                              java.lang.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(java.io.File file,
                         java.lang.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(java.lang.String filePrefix,
                         java.lang.String fileSuffix,
                         java.lang.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(java.lang.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(java.io.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(java.lang.String filePrefix,
                               java.lang.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(java.lang.String message,
                        java.lang.Throwable ex,
                        java.util.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.5 (2011/06/29 09:44 build-8-official)

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