org.apache.geronimo.system.logging.log4j
Class Log4jService

java.lang.Object
  extended by org.apache.geronimo.system.logging.log4j.Log4jService
All Implemented Interfaces:
GBeanLifecycle, SystemLog

public class Log4jService
extends Object
implements GBeanLifecycle, SystemLog

A Log4j logging service.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.geronimo.system.logging.SystemLog
SystemLog.LogMessage, SystemLog.SearchResults
 
Field Summary
static GBeanInfo GBEAN_INFO
           
 
Fields inherited from interface org.apache.geronimo.system.logging.SystemLog
MAX_SEARCH_RESULTS
 
Constructor Summary
Log4jService(String configurationFile, int refreshPeriod, ServerInfo serverInfo)
          Construct a Log4jService.
 
Method Summary
 void doFail()
          Fails the GBean.
 void doStart()
          Starts the GBean.
 void doStop()
          Stops the target.
 String getConfigFileName()
          Get the logging configuration URL.
 String getConfiguration()
          Get the content of logging configuration file.
static GBeanInfo getGBeanInfo()
           
 String[] getLogFileNames()
          Gets the name of all log files used by this log system.
 String getLoggerEffectiveLevel(String logger)
          Gets the level of the logger of the give name.
 String getLoggerLevel(String logger)
          Gets the level of the logger of the give name.
 SystemLog.SearchResults getMatchingItems(String logFile, Integer firstLine, Integer lastLine, String minLevel, String text, int maxResults, boolean includeStackTraces)
          Searches the log for records matching the specified parameters.
 int getRefreshPeriodSeconds()
          Get the refresh period.
 String getRootLoggerLevel()
          Gets the level of the root logger.
 void reconfigure()
          Force the logging system to reconfigure.
 void setConfigFileName(String configurationFile)
          Set the logging configuration URL.
 void setConfiguration(String configuration)
          Overwrites the content of logging configuration file.
 void setLoggerLevel(String logger, String level)
          Sets the level for a logger of the give name.
 void setRefreshPeriodSeconds(int period)
          Set the refresh period.
 void setRootLoggerLevel(String level)
          Sets the level of the root logger.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GBEAN_INFO

public static final GBeanInfo GBEAN_INFO
Constructor Detail

Log4jService

public Log4jService(String configurationFile,
                    int refreshPeriod,
                    ServerInfo serverInfo)
Construct a Log4jService.

Parameters:
configurationFile - The log4j configuration file.
refreshPeriod - The refresh refreshPeriod (in seconds).
Method Detail

getRootLoggerLevel

public String getRootLoggerLevel()
Gets the level of the root logger.

Specified by:
getRootLoggerLevel in interface SystemLog

setRootLoggerLevel

public void setRootLoggerLevel(String level)
Sets the level of the root logger.

Specified by:
setRootLoggerLevel in interface SystemLog
Parameters:
level - The level to change the logger to.

getLoggerEffectiveLevel

public String getLoggerEffectiveLevel(String logger)
Gets the level of the logger of the give name.

Parameters:
logger - The logger to inspect.

getLoggerLevel

public String getLoggerLevel(String logger)
Gets the level of the logger of the give name.

Parameters:
logger - The logger to inspect.

setLoggerLevel

public void setLoggerLevel(String logger,
                           String level)
Sets the level for a logger of the give name.

Parameters:
logger - The logger to change level
level - The level to change the logger to.

getRefreshPeriodSeconds

public int getRefreshPeriodSeconds()
Get the refresh period.

Specified by:
getRefreshPeriodSeconds in interface SystemLog
Returns:
the refresh period (in seconds)

setRefreshPeriodSeconds

public void setRefreshPeriodSeconds(int period)
Set the refresh period.

Specified by:
setRefreshPeriodSeconds in interface SystemLog
Parameters:
period - the refresh period (in seconds)
Throws:
IllegalArgumentException - if refresh period is < 5

getConfigFileName

public String getConfigFileName()
Get the logging configuration URL.

Specified by:
getConfigFileName in interface SystemLog
Returns:
the logging configuration URL

setConfigFileName

public void setConfigFileName(String configurationFile)
Set the logging configuration URL.

Specified by:
setConfigFileName in interface SystemLog
Parameters:
configurationFile - the logging configuration file

getConfiguration

public String getConfiguration()
Get the content of logging configuration file.

Returns:
the content of logging configuration file

setConfiguration

public void setConfiguration(String configuration)
                      throws IOException
Overwrites the content of logging configuration file.

Parameters:
configuration - the new content of logging configuration file
Throws:
IOException

getLogFileNames

public String[] getLogFileNames()
Description copied from interface: SystemLog
Gets the name of all log files used by this log system. Typically there is only one, but specialized cases may use more.

Specified by:
getLogFileNames in interface SystemLog

getMatchingItems

public SystemLog.SearchResults getMatchingItems(String logFile,
                                                Integer firstLine,
                                                Integer lastLine,
                                                String minLevel,
                                                String text,
                                                int maxResults,
                                                boolean includeStackTraces)
Description copied from interface: SystemLog
Searches the log for records matching the specified parameters. The maximum results returned will be the lesser of 1000 and the provided maxResults argument.

Specified by:
getMatchingItems in interface SystemLog
See Also:
SystemLog.MAX_SEARCH_RESULTS

reconfigure

public void reconfigure()
Force the logging system to reconfigure.


doStart

public void doStart()
Description copied from interface: GBeanLifecycle
Starts the GBean. This informs the GBean that it is about to transition to the running state.

Specified by:
doStart in interface GBeanLifecycle

doStop

public void doStop()
Description copied from interface: GBeanLifecycle
Stops the target. This informs the GBean that it is about to transition to the stopped state.

Specified by:
doStop in interface GBeanLifecycle

doFail

public void doFail()
Description copied from interface: GBeanLifecycle
Fails the GBean. This informs the GBean that it is about to transition to the failed state.

Specified by:
doFail in interface GBeanLifecycle

getGBeanInfo

public static GBeanInfo getGBeanInfo()


Copyright © 2003-2007 Apache Software Foundation. All Rights Reserved.