|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.springframework.util.Log4jConfigurer
Convenience class that features simple methods for custom Log4J configuration.
Log4jWebConfigurer
,
Log4jConfigListener
Field Summary | |
static long |
DEFAULT_REFRESH_INTERVAL
Deprecated. Either choose no config file refreshing (initLogging with plain location) or specify an explicit refresh interval. As of Spring 1.1.3, there is no default refresh interval; the default is no config file refreshing now. The rationale is to avoid Log4J's watchdog thread (which never terminates) unless explicitly required. |
static String |
XML_FILE_EXTENSION
|
Constructor Summary | |
Log4jConfigurer()
|
Method Summary | |
static void |
initLogging(String location)
Initialize Log4J from the given location, with no config file refreshing. |
static void |
initLogging(String location,
long refreshInterval)
Initialize Log4J from the given location, with the given refresh interval for the config file. |
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 |
public static final long DEFAULT_REFRESH_INTERVAL
initLogging(String)
,
initLogging(String, long)
,
Constant Field Valuespublic static final String XML_FILE_EXTENSION
Constructor Detail |
public Log4jConfigurer()
Method Detail |
public static void initLogging(String location) throws FileNotFoundException
location
- the location of the config file
FileNotFoundException
- if the location specifies an invalid file pathDEFAULT_REFRESH_INTERVAL
public static void initLogging(String location, long refreshInterval) throws FileNotFoundException
Log4J's watchdog thread will asynchronously check whether the timestamp of the config file has changed, using the given interval between checks. A refresh interval of 1000 milliseconds (one second), which allows to do on-demand log level changes with immediate effect, is not unfeasible.
WARNING: Log4J's watchdog thread does not terminate until VM shutdown; in particular, it does not terminate on LogManager shutdown. Therefore, it is recommended to not use config file refreshing in a production J2EE environment; the watchdog thread would not stop on application shutdown there.
location
- the location of the config filerefreshInterval
- interval between config file refresh checks, in milliseconds
FileNotFoundException
- if the location specifies an invalid file pathpublic static void shutdownLogging()
public static void setWorkingDirSystemProperty(String key)
key
- system property key to useLog4jWebConfigurer
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |