org.springframework.util
Class Log4jConfigurer

java.lang.Object
  extended byorg.springframework.util.Log4jConfigurer

public abstract class Log4jConfigurer
extends Object

Convenience class that features simple methods for custom Log4J configuration.

Since:
13.03.2003
Author:
Juergen Hoeller
See Also:
Log4jWebConfigurer, Log4jConfigListener

Field Summary
static long DEFAULT_REFRESH_INTERVAL
           
static String XML_FILE_EXTENSION
           
 
Constructor Summary
Log4jConfigurer()
           
 
Method Summary
static void initLogging(String location)
          Initialize Log4J with the given configuration and the default refresh interval.
static void initLogging(String location, long refreshInterval)
          Initialize Log4J with the given configuration.
static void setWorkingDirSystemProperty(String key)
          Set the specified system property to the current working directory.
static void shutdownLogging()
          Shutdown Log4J to release all file locks.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_REFRESH_INTERVAL

public static final long DEFAULT_REFRESH_INTERVAL
See Also:
Constant Field Values

XML_FILE_EXTENSION

public static final String XML_FILE_EXTENSION
See Also:
Constant Field Values
Constructor Detail

Log4jConfigurer

public Log4jConfigurer()
Method Detail

initLogging

public static void initLogging(String location)
                        throws FileNotFoundException
Initialize Log4J with the given configuration and the default refresh interval. (org.apache.log4j.helpers.FileWatchdog.DEFAULT_DELAY, normally 60 seconds).

Parameters:
location - location of the property config file
Throws:
FileNotFoundException - if the location specifies an invalid file path

initLogging

public static void initLogging(String location,
                               long refreshInterval)
                        throws FileNotFoundException
Initialize Log4J with the given configuration. Assumes an XML file in case of a ".xml" file extension.

Parameters:
location - location of the config file
refreshInterval - interval between config file refresh checks, in milliseconds
Throws:
FileNotFoundException - if the location specifies an invalid file path

shutdownLogging

public static void shutdownLogging()
Shutdown Log4J to release all file locks.


setWorkingDirSystemProperty

public static void setWorkingDirSystemProperty(String key)
Set the specified system property to the current working directory. This can be used e.g. for test environments, for applications that leverage Log4jWebConfigurer's "webAppRootKey" support in a web environment.

Parameters:
key - system property key to use
See Also:
Log4jWebConfigurer


Copyright (C) 2003-2004 The Spring Framework Project.