org.apache.turbine.services.logging
Class TurbineLoggingService

java.lang.Object
  |
  +--org.apache.turbine.services.BaseInitable
        |
        +--org.apache.turbine.services.BaseService
              |
              +--org.apache.turbine.services.TurbineBaseService
                    |
                    +--org.apache.turbine.services.logging.TurbineLoggingService
All Implemented Interfaces:
Initable, LoggingService, Service
Direct Known Subclasses:
ServletLoggingService

public class TurbineLoggingService
extends TurbineBaseService
implements LoggingService

The default implementation of the logging service in Turbine. This service functions as a logger provider. It allows access to loggers: explicite by the getLogger method, or by printing methods (info, error...). Real work is done by classes that implement interface: Logger. The configuration of the service is read from the TurbineResources.properties. The rest of the configuration is done through a defined LoggingConfig class. Names of the loggers, classes, log levels, destinations are defined in that file.

Version:
$Id: TurbineLoggingService.java,v 1.5 2002/08/14 16:44:09 henning Exp $
Author:
Tomasz Zielinski, Jon S. Stevens
See Also:
Logger

Field Summary
protected  javax.servlet.ServletContext context
          context for resolving paths and servlet logging
protected  Logger defaultLogger
          logger for methods without target
protected  java.util.Hashtable loggersTable
          loggers repository
protected  Logger simpleLogger
          bootstrap and shutdown logger using context.log
 
Fields inherited from class org.apache.turbine.services.BaseService
configuration, name, properties, serviceBroker
 
Fields inherited from class org.apache.turbine.services.BaseInitable
initableBroker, isInitialized
 
Fields inherited from interface org.apache.turbine.services.logging.LoggingService
SERVICE_NAME
 
Constructor Summary
TurbineLoggingService()
           
 
Method Summary
 void debug(java.lang.String message)
          This is a log method with logLevel == DEBUG, printing is done by the default logger
 void debug(java.lang.String message, RunData data)
          This is a log method with logLevel == DEBUG, printing is done by the default logger
 void debug(java.lang.String message, RunData data, java.lang.Throwable t)
          This is a log method with logLevel == DEBUG, printing is done by the default logger
 void debug(java.lang.String logName, java.lang.String message)
          This is a log method with logLevel == DEBUG, printing is done by the given logger
 void debug(java.lang.String logName, java.lang.String message, RunData data)
          This is a log method with logLevel == DEBUG, printing is done by the given logger
 void debug(java.lang.String logName, java.lang.String message, RunData data, java.lang.Throwable t)
          This is a log method with logLevel == DEBUG, printing is done by the given logger
 void debug(java.lang.String logName, java.lang.String message, java.lang.Throwable t)
          This is a log method with logLevel == DEBUG, printing is done by the given logger
 void debug(java.lang.String message, java.lang.Throwable t)
          This is a log method with logLevel == DEBUG, printing is done by the default logger
 void error(java.lang.String message)
          This is a log method with logLevel == ERROR, printing is done by the default logger
 void error(java.lang.String message, RunData data)
          This is a log method with logLevel == ERROR, printing is done by the default logger
 void error(java.lang.String message, RunData data, java.lang.Throwable t)
          This is a log method with logLevel == ERROR, printing is done by the default logger
 void error(java.lang.String logName, java.lang.String message)
          This is a log method with logLevel == ERROR, printing is done by the given logger
 void error(java.lang.String logName, java.lang.String message, RunData data)
          This is a log method with logLevel == ERROR, printing is done by the given logger
 void error(java.lang.String logName, java.lang.String message, RunData data, java.lang.Throwable t)
          This is a log method with logLevel == ERROR, printing is done by the given logger
 void error(java.lang.String logName, java.lang.String message, java.lang.Throwable t)
          This is a log method with logLevel == ERROR, printing is done by the given logger
 void error(java.lang.String message, java.lang.Throwable t)
          This is a log method with logLevel == ERROR, printing is done by the default logger
 Logger getLogger()
          This method returns default logger for Turbine System
 Logger getLogger(java.lang.String logName)
          This method returns logger with given name.
 LoggingConfig getLoggingConfig()
          Creates a new LoggingConfig object.
 ResourceService getResources()
          This gets the ResourceService associated to this Service
 void info(java.lang.String message)
          This is a log method with logLevel == INFO, printing is done by the default logger
 void info(java.lang.String message, RunData data)
          This is a log method with logLevel == INFO, printing is done by the default logger
 void info(java.lang.String message, RunData data, java.lang.Throwable t)
          This is a log method with logLevel == INFO,printing is done by the default logger
 void info(java.lang.String logName, java.lang.String message)
          This is a log method with logLevel == INFO, printing is done by the given logger
 void info(java.lang.String logName, java.lang.String message, RunData data)
          This is a log method with logLevel == INFO, printing is done by the given logger
 void info(java.lang.String logName, java.lang.String message, RunData data, java.lang.Throwable t)
          This is a log method with logLevel == INFO, printing is done by the given logger
 void info(java.lang.String logName, java.lang.String message, java.lang.Throwable t)
          This is a log method with logLevel == INFO, printing is done by the given logger
 void info(java.lang.String message, java.lang.Throwable t)
          This is a log method with logLevel == INFO, printing is done by the default logger
 void init()
          Load all configured components and initialize them.
 void init(javax.servlet.ServletConfig config)
          Inits the service using servlet parameters to obtain path to the configuration file.
protected  void loadLogger(LoggingConfig loggingConfig)
          Creates instances of the logger, configures it, and adds it to the hashTable.
 void setFormat(java.lang.String format)
          This method sets format style of the default logger
 void setFormat(java.lang.String logName, java.lang.String format)
          This method sets format style of the given logger.
 void setLogLevel(int level)
          This method sets the log level of the default logger.
 void setLogLevel(java.lang.String logName, int level)
          This method sets the log level of the logger of given name.
 void shutdown()
          Shutdowns all loggers.
 void warn(java.lang.String message)
          This is a log method with logLevel == WARN, printing is done by the default logger
 void warn(java.lang.String message, RunData data)
          This is a log method with logLevel == WARN,printing is done by the default logger
 void warn(java.lang.String message, RunData data, java.lang.Throwable t)
          This is a log method with logLevel == WARN, printing is done by the default logger
 void warn(java.lang.String logName, java.lang.String message)
          This is a log method with logLevel == WARN, printing is done by the given logger
 void warn(java.lang.String logName, java.lang.String message, RunData data)
          This is a log method with logLevel == WARN, printing is done by the given logger
 void warn(java.lang.String logName, java.lang.String message, RunData data, java.lang.Throwable t)
          This is a log method with logLevel == WARN, printing is done by the given logger
 void warn(java.lang.String logName, java.lang.String message, java.lang.Throwable t)
          This is a log method with logLevel == WARN, printing is done by the given logger
 void warn(java.lang.String message, java.lang.Throwable t)
          This is a log method with logLevel == WARN, printing is done by the default logger
 
Methods inherited from class org.apache.turbine.services.TurbineBaseService
init, init
 
Methods inherited from class org.apache.turbine.services.BaseService
getConfiguration, getName, getProperties, getServiceBroker, setName, setServiceBroker
 
Methods inherited from class org.apache.turbine.services.BaseInitable
getInit, getInitableBroker, setInit, setInitableBroker
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.turbine.services.Service
getConfiguration, getName, getProperties, setName, setServiceBroker
 
Methods inherited from interface org.apache.turbine.services.Initable
getInit, init, setInitableBroker
 

Field Detail

loggersTable

protected java.util.Hashtable loggersTable
loggers repository

defaultLogger

protected Logger defaultLogger
logger for methods without target

simpleLogger

protected Logger simpleLogger
bootstrap and shutdown logger using context.log

context

protected javax.servlet.ServletContext context
context for resolving paths and servlet logging
Constructor Detail

TurbineLoggingService

public TurbineLoggingService()
Method Detail

init

public void init()
          throws InitializationException
Load all configured components and initialize them. This is a zero parameter variant which queries the Turbine Servlet for its config.
Specified by:
init in interface Initable
Overrides:
init in class TurbineBaseService
Throws:
InitializationException - Something went wrong in the init stage

init

public void init(javax.servlet.ServletConfig config)
          throws InitializationException
Inits the service using servlet parameters to obtain path to the configuration file. Change relatives paths.
Overrides:
init in class TurbineBaseService
Parameters:
config - The ServletConfiguration from Turbine
Throws:
InitializationException - Something went wrong when starting up.

getLoggingConfig

public LoggingConfig getLoggingConfig()
                               throws InitializationException
Creates a new LoggingConfig object. By default, this is a PropertiesLoggingConfig object. You can override this by changing your TurbineResources.properties file to something else. Prop: services.TurbineLoggingService.loggingConfig FIXME: Not built for speed. :-(

getResources

public ResourceService getResources()
This gets the ResourceService associated to this Service

loadLogger

protected void loadLogger(LoggingConfig loggingConfig)
                   throws InitializationException
Creates instances of the logger, configures it, and adds it to the hashTable. It skips loggers if there where errors.
Parameters:
loggerDescription - xml-Node defining the logger

shutdown

public void shutdown()
Shutdowns all loggers. After shutdown servlet logger is still available using the servlet log method
Specified by:
shutdown in interface Initable
Overrides:
shutdown in class TurbineBaseService

getLogger

public final Logger getLogger()
This method returns default logger for Turbine System
Specified by:
getLogger in interface LoggingService

getLogger

public Logger getLogger(java.lang.String logName)
This method returns logger with given name.
Specified by:
getLogger in interface LoggingService

setLogLevel

public void setLogLevel(int level)
This method sets the log level of the default logger.
Specified by:
setLogLevel in interface LoggingService

setLogLevel

public void setLogLevel(java.lang.String logName,
                        int level)
This method sets the log level of the logger of given name.
Specified by:
setLogLevel in interface LoggingService

setFormat

public void setFormat(java.lang.String format)
This method sets format style of the default logger
Specified by:
setFormat in interface LoggingService

setFormat

public void setFormat(java.lang.String logName,
                      java.lang.String format)
This method sets format style of the given logger.
Specified by:
setFormat in interface LoggingService

debug

public void debug(java.lang.String message)
This is a log method with logLevel == DEBUG, printing is done by the default logger
Specified by:
debug in interface LoggingService

debug

public void debug(java.lang.String message,
                  java.lang.Throwable t)
This is a log method with logLevel == DEBUG, printing is done by the default logger
Specified by:
debug in interface LoggingService

debug

public void debug(java.lang.String logName,
                  java.lang.String message,
                  java.lang.Throwable t)
This is a log method with logLevel == DEBUG, printing is done by the given logger
Specified by:
debug in interface LoggingService

debug

public void debug(java.lang.String logName,
                  java.lang.String message)
This is a log method with logLevel == DEBUG, printing is done by the given logger
Specified by:
debug in interface LoggingService

debug

public void debug(java.lang.String message,
                  RunData data)
This is a log method with logLevel == DEBUG, printing is done by the default logger
Specified by:
debug in interface LoggingService

debug

public void debug(java.lang.String message,
                  RunData data,
                  java.lang.Throwable t)
This is a log method with logLevel == DEBUG, printing is done by the default logger
Specified by:
debug in interface LoggingService

debug

public void debug(java.lang.String logName,
                  java.lang.String message,
                  RunData data,
                  java.lang.Throwable t)
This is a log method with logLevel == DEBUG, printing is done by the given logger
Specified by:
debug in interface LoggingService

debug

public void debug(java.lang.String logName,
                  java.lang.String message,
                  RunData data)
This is a log method with logLevel == DEBUG, printing is done by the given logger
Specified by:
debug in interface LoggingService

info

public void info(java.lang.String message)
This is a log method with logLevel == INFO, printing is done by the default logger
Specified by:
info in interface LoggingService

info

public void info(java.lang.String message,
                 java.lang.Throwable t)
This is a log method with logLevel == INFO, printing is done by the default logger
Specified by:
info in interface LoggingService

info

public void info(java.lang.String logName,
                 java.lang.String message)
This is a log method with logLevel == INFO, printing is done by the given logger
Specified by:
info in interface LoggingService

info

public void info(java.lang.String logName,
                 java.lang.String message,
                 java.lang.Throwable t)
This is a log method with logLevel == INFO, printing is done by the given logger
Specified by:
info in interface LoggingService

info

public void info(java.lang.String message,
                 RunData data)
This is a log method with logLevel == INFO, printing is done by the default logger
Specified by:
info in interface LoggingService

info

public void info(java.lang.String message,
                 RunData data,
                 java.lang.Throwable t)
This is a log method with logLevel == INFO,printing is done by the default logger
Specified by:
info in interface LoggingService

info

public void info(java.lang.String logName,
                 java.lang.String message,
                 RunData data)
This is a log method with logLevel == INFO, printing is done by the given logger
Specified by:
info in interface LoggingService

info

public void info(java.lang.String logName,
                 java.lang.String message,
                 RunData data,
                 java.lang.Throwable t)
This is a log method with logLevel == INFO, printing is done by the given logger
Specified by:
info in interface LoggingService

warn

public void warn(java.lang.String message)
This is a log method with logLevel == WARN, printing is done by the default logger
Specified by:
warn in interface LoggingService

warn

public void warn(java.lang.String message,
                 java.lang.Throwable t)
This is a log method with logLevel == WARN, printing is done by the default logger
Specified by:
warn in interface LoggingService

warn

public void warn(java.lang.String logName,
                 java.lang.String message)
This is a log method with logLevel == WARN, printing is done by the given logger
Specified by:
warn in interface LoggingService

warn

public void warn(java.lang.String logName,
                 java.lang.String message,
                 java.lang.Throwable t)
This is a log method with logLevel == WARN, printing is done by the given logger
Specified by:
warn in interface LoggingService

warn

public void warn(java.lang.String message,
                 RunData data)
This is a log method with logLevel == WARN,printing is done by the default logger
Specified by:
warn in interface LoggingService

warn

public void warn(java.lang.String message,
                 RunData data,
                 java.lang.Throwable t)
This is a log method with logLevel == WARN, printing is done by the default logger
Specified by:
warn in interface LoggingService

warn

public void warn(java.lang.String logName,
                 java.lang.String message,
                 RunData data)
This is a log method with logLevel == WARN, printing is done by the given logger
Specified by:
warn in interface LoggingService

warn

public void warn(java.lang.String logName,
                 java.lang.String message,
                 RunData data,
                 java.lang.Throwable t)
This is a log method with logLevel == WARN, printing is done by the given logger
Specified by:
warn in interface LoggingService

error

public void error(java.lang.String message)
This is a log method with logLevel == ERROR, printing is done by the default logger
Specified by:
error in interface LoggingService

error

public void error(java.lang.String message,
                  java.lang.Throwable t)
This is a log method with logLevel == ERROR, printing is done by the default logger
Specified by:
error in interface LoggingService

error

public void error(java.lang.String logName,
                  java.lang.String message)
This is a log method with logLevel == ERROR, printing is done by the given logger
Specified by:
error in interface LoggingService

error

public void error(java.lang.String logName,
                  java.lang.String message,
                  java.lang.Throwable t)
This is a log method with logLevel == ERROR, printing is done by the given logger
Specified by:
error in interface LoggingService

error

public void error(java.lang.String message,
                  RunData data)
This is a log method with logLevel == ERROR, printing is done by the default logger
Specified by:
error in interface LoggingService

error

public void error(java.lang.String message,
                  RunData data,
                  java.lang.Throwable t)
This is a log method with logLevel == ERROR, printing is done by the default logger
Specified by:
error in interface LoggingService

error

public void error(java.lang.String logName,
                  java.lang.String message,
                  RunData data)
This is a log method with logLevel == ERROR, printing is done by the given logger
Specified by:
error in interface LoggingService

error

public void error(java.lang.String logName,
                  java.lang.String message,
                  RunData data,
                  java.lang.Throwable t)
This is a log method with logLevel == ERROR, printing is done by the given logger
Specified by:
error in interface LoggingService


Copyright © 2000-2002 Apache Software Foundation. All Rights Reserved.