org.springframework.util
Class Log4jConfigurer


public abstract class Log4jConfigurer

Convenience class that features simple methods for custom Log4J configuration.

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

Field Summary
 final static longDEFAULT_REFRESH_INTERVAL
           
 final static StringXML_FILE_EXTENSION
           

Method Summary
 static voidinitLogging(String location)
          Initialize Log4J with the given configuration and the default refresh interval.
 static voidinitLogging(String location, long refreshInterval)
          Initialize Log4J with the given configuration.
 static voidsetWorkingDirSystemProperty(String key)
          Set the specified system property to the current working directory.
 static voidshutdownLogging()
          Shutdown Log4J to release all file locks.

Field Detail

DEFAULT_REFRESH_INTERVAL

public final static long DEFAULT_REFRESH_INTERVAL

XML_FILE_EXTENSION

public final static String XML_FILE_EXTENSION
Method Detail

initLogging

public static void initLogging(String location)
throws java.io.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 java.io.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

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

shutdownLogging

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

Association Links

to Class java.lang.String