common_helper/src/main/java/com/xiongyingqi/util/Log4jConfigurer.java
public static void initLogging(String location, long refreshInterval) throws FileNotFoundException {
        String resolvedLocation = SystemPropertyUtils.resolvePlaceholders(location);
        File file = ResourceUtils.getFile(resolvedLocation);
        if (!file.exists()) {
            throw new FileNotFoundException("Log4j config file [" + resolvedLocation + "] not found");
        }
        if (resolvedLocation.toLowerCase().endsWith(XML_FILE_EXTENSION)) {
            DOMConfigurator.configureAndWatch(file.getAbsolutePath(), refreshInterval);
        } else {
            PropertyConfigurator.configureAndWatch(file.getAbsolutePath(), refreshInterval);
        }
    }
public static void initLogging(String location, long refreshInterval) throws FileNotFoundException {
        String resolvedLocation = SystemPropertyUtils.resolvePlaceholders(location);
        File file = ResourceUtils.getFile(resolvedLocation);
        if (!file.exists()) {
            throw new FileNotFoundException("Log4j config file [" + resolvedLocation + "] not found");
        }
        if (resolvedLocation.toLowerCase().endsWith(XML_FILE_EXTENSION)) {
            DOMConfigurator.configureAndWatch(file.getAbsolutePath(), refreshInterval);
        } else {
            PropertyConfigurator.configureAndWatch(file.getAbsolutePath(), refreshInterval);
        }
    }
Initialize log4j from the given location, with the given refresh interval
for the config file. Assumes an XML file in case of a ".xml" file extension,
and a properties file otherwise.
<p>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.
<p><b>WARNING:</b> Log4j's watchdog thread does not terminate until VM shutdown;
in particular, it does not terminate on LogManager shutdown. Therefore, it is
recommended to <i>not</i> use config file refreshing in a production J2EE
environment; the watchdog thread would not stop on application shutdown there.

@param location        the location of the config file: either a "classpath:" location
(e.g. "classpath:myLog4j.properties"), an absolute file URL
(e.g. "file:C:/log4j.properties), or a plain absolute path in the file system
(e.g. "C:/log4j.properties")
@param refreshInterval interval between config file refresh checks, in milliseconds
@throws java.io.FileNotFoundException if the location specifies an invalid file path