When the log4j configuration file's modification time is a furture time, the Log4jService will produce a serial of log files every 60 seconds. This situation will occur on that we build src on PC_A, and then deploy it on PC_B, which PC_A is one day or several days furture than PC_B.
The root cause is the org.jboss.logging.Log4jService. It schedules a URLWatchTimerTask every 60 seconds. The main work of it is to check whether the log4j is modified, if modified jboss should reload it. But the big point here is that after checking and applying each time, it records the time flag by "lastConfigured = System.currentTimeMillis();", then 60 seconds later it compares the lastConfigured with config file's lastModified:
if (lastConfigured < lastModified)
{
reconfigure(conn);
}
As the config file's lastModified time is a furture time, so this judgement will always return true, and the reconfigure job will be executed every 60 seconds.
Suggestion, why not record the by "lastConfigured = lastModified" ? This will solve this problem.
fixed it :)
link
Last edit: Anonymous 2015-05-25