diff --git a/.classpath b/.classpath index 13fb316..a3a269e 100644 --- a/.classpath +++ b/.classpath @@ -11,11 +11,8 @@ - - - @@ -27,5 +24,9 @@ + + + + diff --git a/lib/Logs/log4j-1.2.17-source.zip b/lib/Logs/log4j-1.2.17-source.zip deleted file mode 100644 index 2a9a7f4..0000000 Binary files a/lib/Logs/log4j-1.2.17-source.zip and /dev/null differ diff --git a/lib/Logs/log4j-1.2.17.jar b/lib/Logs/log4j-1.2.17.jar deleted file mode 100644 index 068867e..0000000 Binary files a/lib/Logs/log4j-1.2.17.jar and /dev/null differ diff --git a/lib/Logs/log4j-api-2.17.0-sources.jar b/lib/Logs/log4j-api-2.17.0-sources.jar new file mode 100644 index 0000000..f895ea8 Binary files /dev/null and b/lib/Logs/log4j-api-2.17.0-sources.jar differ diff --git a/lib/Logs/log4j-api-2.17.0.jar b/lib/Logs/log4j-api-2.17.0.jar new file mode 100644 index 0000000..77af535 Binary files /dev/null and b/lib/Logs/log4j-api-2.17.0.jar differ diff --git a/lib/Logs/log4j-core-2.17.0-sources.jar b/lib/Logs/log4j-core-2.17.0-sources.jar new file mode 100644 index 0000000..6d0e47a Binary files /dev/null and b/lib/Logs/log4j-core-2.17.0-sources.jar differ diff --git a/lib/Logs/log4j-core-2.17.0.jar b/lib/Logs/log4j-core-2.17.0.jar new file mode 100644 index 0000000..256ff3d Binary files /dev/null and b/lib/Logs/log4j-core-2.17.0.jar differ diff --git a/lib/Logs/log4j-slf4j-impl-2.17.0-sources.jar b/lib/Logs/log4j-slf4j-impl-2.17.0-sources.jar new file mode 100644 index 0000000..490e97e Binary files /dev/null and b/lib/Logs/log4j-slf4j-impl-2.17.0-sources.jar differ diff --git a/lib/Logs/log4j-slf4j-impl-2.17.0.jar b/lib/Logs/log4j-slf4j-impl-2.17.0.jar new file mode 100644 index 0000000..6501d11 Binary files /dev/null and b/lib/Logs/log4j-slf4j-impl-2.17.0.jar differ diff --git a/lib/Logs/slf4j-api-1.7.25.jar b/lib/Logs/slf4j-api-1.7.25.jar deleted file mode 100644 index 7e62f13..0000000 Binary files a/lib/Logs/slf4j-api-1.7.25.jar and /dev/null differ diff --git a/lib/Logs/slf4j-api-1.7.25-sources.jar b/lib/Logs/slf4j-api-1.7.32-sources.jar similarity index 65% rename from lib/Logs/slf4j-api-1.7.25-sources.jar rename to lib/Logs/slf4j-api-1.7.32-sources.jar index b2a3d83..e8c4f52 100644 Binary files a/lib/Logs/slf4j-api-1.7.25-sources.jar and b/lib/Logs/slf4j-api-1.7.32-sources.jar differ diff --git a/lib/Logs/slf4j-api-1.7.32.jar b/lib/Logs/slf4j-api-1.7.32.jar new file mode 100644 index 0000000..b16a078 Binary files /dev/null and b/lib/Logs/slf4j-api-1.7.32.jar differ diff --git a/lib/Logs/slf4j-log4j12-1.7.25-sources.jar b/lib/Logs/slf4j-log4j12-1.7.25-sources.jar deleted file mode 100644 index 0cd5be7..0000000 Binary files a/lib/Logs/slf4j-log4j12-1.7.25-sources.jar and /dev/null differ diff --git a/lib/Logs/slf4j-log4j12-1.7.25.jar b/lib/Logs/slf4j-log4j12-1.7.25.jar deleted file mode 100644 index 4a44e06..0000000 Binary files a/lib/Logs/slf4j-log4j12-1.7.25.jar and /dev/null differ diff --git a/log4j.properties b/log4j.properties deleted file mode 100644 index 7b82791..0000000 --- a/log4j.properties +++ /dev/null @@ -1,13 +0,0 @@ -# Log configuration -# ################# - -# priority setting: DEBUG < INFO < WARN < ERROR -log4j.rootLogger = INFO, console -log4j.logger.fr.devinsy.statoolinfos = INFO -log4j.logger.fr.devinsy.xidyn = WARN - -#-- -log4j.appender.console = org.apache.log4j.ConsoleAppender -log4j.appender.console.layout = org.apache.log4j.PatternLayout -#log4j.appender.console.layout.ConversionPattern = %d{ISO8601} - StatoolInfos [%-5p] %34.34c.%25M - %m%n -log4j.appender.console.layout.ConversionPattern = %m%n diff --git a/log4j2.properties b/log4j2.properties new file mode 100644 index 0000000..5708ef0 --- /dev/null +++ b/log4j2.properties @@ -0,0 +1,26 @@ +# Log configuration +# ################# + +# priority setting: DEBUG < INFO < WARN < ERROR +dest = err +name = Log4j2PropertiesConfig +status = ERROR + +# Appenders settings. +appenders = console + +appender.console.type = Console +appender.console.name = LogToConsole +appender.console.layout.type = PatternLayout +appender.console.layout.pattern = %m%n + +# Logger settings. +rootLogger.level = INFO +rootLogger.appenderRefs = a +rootLogger.appenderRef.a.ref = LogToConsole + +logger.statoolinfos.name = fr.devinsy.statoolinfos +logger.statoolinfos.level = INFO + +logger.xidyn.name = fr.devinsy.xidyn +logger.xidyn.level = WARN diff --git a/resources/conf/log4j-default.properties b/resources/conf/log4j-default.properties deleted file mode 100644 index 74041e7..0000000 --- a/resources/conf/log4j-default.properties +++ /dev/null @@ -1,21 +0,0 @@ -# Log configuration -# ################# - -# priority setting: DEBUG < INFO < WARN < ERROR -log4j.rootLogger = INFO, stdout, LogWriter -log4j.logger.fr.devinsy.statoolinfos = INFO -log4j.logger.fr.devinsy.xidyn = INFO - -#-- -log4j.appender.stdout = org.apache.log4j.ConsoleAppender -log4j.appender.stdout.layout = org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern = %m%n - - -#-- -log4j.appender.LogWriter = org.apache.log4j.RollingFileAppender -log4j.appender.LogWriter.File = /srv/StatoolInfos/tatoolinfos.log -log4j.appender.LogWriter.MaxFileSize = 100000KB -log4j.appender.LogWriter.MaxBackupIndex = 5 -log4j.appender.LogWriter.layout = org.apache.log4j.PatternLayout -log4j.appender.LogWriter.layout.ConversionPattern = %d{ISO8601} - InfosStatool [%-5p] %34.34c.%-25M - %m%n diff --git a/resources/conf/log4j2-default.properties b/resources/conf/log4j2-default.properties new file mode 100644 index 0000000..5708ef0 --- /dev/null +++ b/resources/conf/log4j2-default.properties @@ -0,0 +1,26 @@ +# Log configuration +# ################# + +# priority setting: DEBUG < INFO < WARN < ERROR +dest = err +name = Log4j2PropertiesConfig +status = ERROR + +# Appenders settings. +appenders = console + +appender.console.type = Console +appender.console.name = LogToConsole +appender.console.layout.type = PatternLayout +appender.console.layout.pattern = %m%n + +# Logger settings. +rootLogger.level = INFO +rootLogger.appenderRefs = a +rootLogger.appenderRef.a.ref = LogToConsole + +logger.statoolinfos.name = fr.devinsy.statoolinfos +logger.statoolinfos.level = INFO + +logger.xidyn.name = fr.devinsy.xidyn +logger.xidyn.level = WARN diff --git a/src/fr/devinsy/statoolinfos/StatoolInfosLauncher.java b/src/fr/devinsy/statoolinfos/StatoolInfosLauncher.java index aed3cca..b603689 100644 --- a/src/fr/devinsy/statoolinfos/StatoolInfosLauncher.java +++ b/src/fr/devinsy/statoolinfos/StatoolInfosLauncher.java @@ -20,11 +20,9 @@ package fr.devinsy.statoolinfos; import java.io.File; -import org.apache.log4j.BasicConfigurator; -import org.apache.log4j.ConsoleAppender; -import org.apache.log4j.EnhancedPatternLayout; -import org.apache.log4j.Level; -import org.apache.log4j.PropertyConfigurator; +import org.apache.logging.log4j.Level; +import org.apache.logging.log4j.core.config.Configurator; +import org.apache.logging.log4j.core.config.DefaultConfiguration; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -56,14 +54,14 @@ public final class StatoolInfosLauncher File loggerConfig = new File("log4j.properties"); if (loggerConfig.exists()) { - PropertyConfigurator.configure(loggerConfig.getAbsolutePath()); + Configurator.initialize(null, loggerConfig.getAbsolutePath()); logger.info("Dedicated log configuration done."); logger.info("Configuration file was found in [{}].", loggerConfig.getAbsoluteFile()); } else { - BasicConfigurator.configure(new ConsoleAppender(new EnhancedPatternLayout("%m%n"))); - org.apache.log4j.Logger.getRootLogger().setLevel(Level.INFO); + Configurator.initialize(new DefaultConfiguration()); + Configurator.setRootLevel(Level.INFO); } // Run. diff --git a/test/fr/devinsy/statoolinfos/core/StatoolInfosTest.java b/test/fr/devinsy/statoolinfos/core/StatoolInfosTest.java index f652af3..59f9ae0 100644 --- a/test/fr/devinsy/statoolinfos/core/StatoolInfosTest.java +++ b/test/fr/devinsy/statoolinfos/core/StatoolInfosTest.java @@ -18,9 +18,9 @@ */ package fr.devinsy.statoolinfos.core; -import org.apache.log4j.BasicConfigurator; -import org.apache.log4j.Level; -import org.apache.log4j.Logger; +import org.apache.logging.log4j.Level; +import org.apache.logging.log4j.core.config.Configurator; +import org.apache.logging.log4j.core.config.DefaultConfiguration; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; @@ -60,7 +60,7 @@ public class StatoolInfosTest @BeforeClass public static void beforeClass() throws StatoolInfosException { - BasicConfigurator.configure(); - Logger.getRootLogger().setLevel(Level.DEBUG); + Configurator.initialize(new DefaultConfiguration()); + Configurator.setRootLevel(Level.DEBUG); } } diff --git a/test/fr/devinsy/statoolinfos/metrics/http/UserAgentBotDetectorTest.java b/test/fr/devinsy/statoolinfos/metrics/http/UserAgentBotDetectorTest.java index 5b6a3ae..17f0772 100644 --- a/test/fr/devinsy/statoolinfos/metrics/http/UserAgentBotDetectorTest.java +++ b/test/fr/devinsy/statoolinfos/metrics/http/UserAgentBotDetectorTest.java @@ -18,9 +18,9 @@ */ package fr.devinsy.statoolinfos.metrics.http; -import org.apache.log4j.BasicConfigurator; -import org.apache.log4j.Level; -import org.apache.log4j.Logger; +import org.apache.logging.log4j.Level; +import org.apache.logging.log4j.core.config.Configurator; +import org.apache.logging.log4j.core.config.DefaultConfiguration; import org.junit.AfterClass; import org.junit.Assert; import org.junit.BeforeClass; @@ -72,7 +72,7 @@ public class UserAgentBotDetectorTest @BeforeClass public static void beforeClass() throws StatoolInfosException { - BasicConfigurator.configure(); - Logger.getRootLogger().setLevel(Level.DEBUG); + Configurator.initialize(new DefaultConfiguration()); + Configurator.setRootLevel(Level.DEBUG); } } diff --git a/test/fr/devinsy/statoolinfos/metrics/http/VisitCountersTest.java b/test/fr/devinsy/statoolinfos/metrics/http/VisitCountersTest.java index 07832b6..47e23b6 100644 --- a/test/fr/devinsy/statoolinfos/metrics/http/VisitCountersTest.java +++ b/test/fr/devinsy/statoolinfos/metrics/http/VisitCountersTest.java @@ -20,9 +20,9 @@ package fr.devinsy.statoolinfos.metrics.http; import java.time.LocalDateTime; -import org.apache.log4j.BasicConfigurator; -import org.apache.log4j.Level; -import org.apache.log4j.Logger; +import org.apache.logging.log4j.Level; +import org.apache.logging.log4j.core.config.Configurator; +import org.apache.logging.log4j.core.config.DefaultConfiguration; import org.junit.AfterClass; import org.junit.Assert; import org.junit.BeforeClass; @@ -271,7 +271,7 @@ public class VisitCountersTest @BeforeClass public static void beforeClass() throws StatoolInfosException { - BasicConfigurator.configure(); - Logger.getRootLogger().setLevel(Level.DEBUG); + Configurator.initialize(new DefaultConfiguration()); + Configurator.setRootLevel(Level.DEBUG); } }