Search in sources :

Example 1 with Reconfigurable

use of org.apache.logging.log4j.core.config.Reconfigurable in project logging-log4j2 by apache.

the class BuiltConfiguration method setMonitorInterval.

public void setMonitorInterval(final int intervalSeconds) {
    if (this instanceof Reconfigurable && intervalSeconds > 0) {
        final ConfigurationSource configSource = getConfigurationSource();
        if (configSource != null) {
            final File configFile = configSource.getFile();
            if (intervalSeconds > 0) {
                getWatchManager().setIntervalSeconds(intervalSeconds);
                if (configFile != null) {
                    final FileWatcher watcher = new ConfiguratonFileWatcher((Reconfigurable) this, listeners);
                    getWatchManager().watchFile(configFile, watcher);
                }
            }
        }
    }
}
Also used : ConfigurationSource(org.apache.logging.log4j.core.config.ConfigurationSource) FileWatcher(org.apache.logging.log4j.core.util.FileWatcher) ConfiguratonFileWatcher(org.apache.logging.log4j.core.config.ConfiguratonFileWatcher) File(java.io.File) ConfiguratonFileWatcher(org.apache.logging.log4j.core.config.ConfiguratonFileWatcher) Reconfigurable(org.apache.logging.log4j.core.config.Reconfigurable)

Aggregations

File (java.io.File)1 ConfigurationSource (org.apache.logging.log4j.core.config.ConfigurationSource)1 ConfiguratonFileWatcher (org.apache.logging.log4j.core.config.ConfiguratonFileWatcher)1 Reconfigurable (org.apache.logging.log4j.core.config.Reconfigurable)1 FileWatcher (org.apache.logging.log4j.core.util.FileWatcher)1