From fd72b5389257ef2a38b71e5f0f45e09e26b3501a Mon Sep 17 00:00:00 2001 From: Decebal Suiu Date: Wed, 22 Apr 2020 09:58:24 +0300 Subject: [PATCH] Switch to Log4j2 --- demo/app/pom.xml | 20 ++++++++------ demo/app/src/main/resources/log4j.properties | 20 -------------- demo/app/src/main/resources/log4j2.properties | 27 +++++++++++++++++++ .../resources/archetype-resources/app/pom.xml | 20 ++++++++------ .../app/src/main/resources/log4j.properties | 20 -------------- .../app/src/main/resources/log4j2.properties | 27 +++++++++++++++++++ .../resources/archetype-resources/pom.xml | 1 + pf4j/pom.xml | 26 +++++++++++++----- pf4j/src/test/resources/log4j.properties | 20 -------------- pf4j/src/test/resources/log4j2.properties | 27 +++++++++++++++++++ pom.xml | 1 + 11 files changed, 127 insertions(+), 82 deletions(-) delete mode 100644 demo/app/src/main/resources/log4j.properties create mode 100644 demo/app/src/main/resources/log4j2.properties delete mode 100755 maven-archetypes/quickstart/src/main/resources/archetype-resources/app/src/main/resources/log4j.properties create mode 100755 maven-archetypes/quickstart/src/main/resources/archetype-resources/app/src/main/resources/log4j2.properties delete mode 100644 pf4j/src/test/resources/log4j.properties create mode 100644 pf4j/src/test/resources/log4j2.properties diff --git a/demo/app/pom.xml b/demo/app/pom.xml index 47a8a99..adeaf3e 100644 --- a/demo/app/pom.xml +++ b/demo/app/pom.xml @@ -75,17 +75,21 @@ ${project.version} - + - log4j - log4j - 1.2.16 + org.apache.logging.log4j + log4j-api + ${log4j.version} + + + org.apache.logging.log4j + log4j-core + ${log4j.version} - - org.slf4j - slf4j-log4j12 - ${slf4j.version} + org.apache.logging.log4j + log4j-slf4j-impl + ${log4j.version} diff --git a/demo/app/src/main/resources/log4j.properties b/demo/app/src/main/resources/log4j.properties deleted file mode 100644 index a05d9eb..0000000 --- a/demo/app/src/main/resources/log4j.properties +++ /dev/null @@ -1,20 +0,0 @@ -log4j.rootLogger=DEBUG, Console - -# -# PF4J log -# -log4j.logger.org.pf4j=DEBUG, Console -# !!! Put the bellow classes on level TRACE when you are in trouble -log4j.logger.org.pf4j.PluginClassLoader=DEBUG, Console -log4j.logger.org.pf4j.AbstractExtensionFinder=DEBUG, Console -log4j.additivity.org.pf4j=false -log4j.additivity.org.pf4j.PluginClassLoader=false -log4j.additivity.org.pf4j.AbstractExtensionFinder=false - -# -# Appenders -# -log4j.appender.Console=org.apache.log4j.ConsoleAppender -log4j.appender.Console.layout=org.apache.log4j.PatternLayout -#log4j.appender.Console.layout.conversionPattern=%-5p - %-32.32c{1} - %m\n -log4j.appender.Console.layout.ConversionPattern=%d %p %c - %m%n diff --git a/demo/app/src/main/resources/log4j2.properties b/demo/app/src/main/resources/log4j2.properties new file mode 100644 index 0000000..958b8d2 --- /dev/null +++ b/demo/app/src/main/resources/log4j2.properties @@ -0,0 +1,27 @@ +# +# Appenders +# +appender.console.type = Console +appender.console.name = console +appender.console.layout.type = PatternLayout +#appender.console.layout.pattern = %-5p - %-32.32c{1} - %m\n +appender.console.layout.pattern = %d %p %c - %m%n + +# +# Loggers +# + +# PF4J log +logger.pf4j.name = org.pf4j +logger.pf4j.level = debug +logger.pf4j.additivity = false +logger.pf4j.appenderRef.console.ref = console + +# !!! Uncomment below loggers when you are in trouble +#logger.loader.name = org.pf4j.PluginClassLoader +#logger.loader.level = trace +#logger.finder.name = org.pf4j.AbstractExtensionFinder +#logger.finder.level = trace + +rootLogger.level = debug +rootLogger.appenderRef.console.ref = console diff --git a/maven-archetypes/quickstart/src/main/resources/archetype-resources/app/pom.xml b/maven-archetypes/quickstart/src/main/resources/archetype-resources/app/pom.xml index 986c0a3..f4bf2ff 100644 --- a/maven-archetypes/quickstart/src/main/resources/archetype-resources/app/pom.xml +++ b/maven-archetypes/quickstart/src/main/resources/archetype-resources/app/pom.xml @@ -63,17 +63,21 @@ ${pf4j.version} - + - log4j - log4j - 1.2.16 + org.apache.logging.log4j + log4j-api + ${log4j.version} + + + org.apache.logging.log4j + log4j-core + ${log4j.version} - - org.slf4j - slf4j-log4j12 - ${slf4j.version} + org.apache.logging.log4j + log4j-slf4j-impl + ${log4j.version} diff --git a/maven-archetypes/quickstart/src/main/resources/archetype-resources/app/src/main/resources/log4j.properties b/maven-archetypes/quickstart/src/main/resources/archetype-resources/app/src/main/resources/log4j.properties deleted file mode 100755 index a05d9eb..0000000 --- a/maven-archetypes/quickstart/src/main/resources/archetype-resources/app/src/main/resources/log4j.properties +++ /dev/null @@ -1,20 +0,0 @@ -log4j.rootLogger=DEBUG, Console - -# -# PF4J log -# -log4j.logger.org.pf4j=DEBUG, Console -# !!! Put the bellow classes on level TRACE when you are in trouble -log4j.logger.org.pf4j.PluginClassLoader=DEBUG, Console -log4j.logger.org.pf4j.AbstractExtensionFinder=DEBUG, Console -log4j.additivity.org.pf4j=false -log4j.additivity.org.pf4j.PluginClassLoader=false -log4j.additivity.org.pf4j.AbstractExtensionFinder=false - -# -# Appenders -# -log4j.appender.Console=org.apache.log4j.ConsoleAppender -log4j.appender.Console.layout=org.apache.log4j.PatternLayout -#log4j.appender.Console.layout.conversionPattern=%-5p - %-32.32c{1} - %m\n -log4j.appender.Console.layout.ConversionPattern=%d %p %c - %m%n diff --git a/maven-archetypes/quickstart/src/main/resources/archetype-resources/app/src/main/resources/log4j2.properties b/maven-archetypes/quickstart/src/main/resources/archetype-resources/app/src/main/resources/log4j2.properties new file mode 100755 index 0000000..958b8d2 --- /dev/null +++ b/maven-archetypes/quickstart/src/main/resources/archetype-resources/app/src/main/resources/log4j2.properties @@ -0,0 +1,27 @@ +# +# Appenders +# +appender.console.type = Console +appender.console.name = console +appender.console.layout.type = PatternLayout +#appender.console.layout.pattern = %-5p - %-32.32c{1} - %m\n +appender.console.layout.pattern = %d %p %c - %m%n + +# +# Loggers +# + +# PF4J log +logger.pf4j.name = org.pf4j +logger.pf4j.level = debug +logger.pf4j.additivity = false +logger.pf4j.appenderRef.console.ref = console + +# !!! Uncomment below loggers when you are in trouble +#logger.loader.name = org.pf4j.PluginClassLoader +#logger.loader.level = trace +#logger.finder.name = org.pf4j.AbstractExtensionFinder +#logger.finder.level = trace + +rootLogger.level = debug +rootLogger.appenderRef.console.ref = console diff --git a/maven-archetypes/quickstart/src/main/resources/archetype-resources/pom.xml b/maven-archetypes/quickstart/src/main/resources/archetype-resources/pom.xml index 13ed127..5a4bade 100755 --- a/maven-archetypes/quickstart/src/main/resources/archetype-resources/pom.xml +++ b/maven-archetypes/quickstart/src/main/resources/archetype-resources/pom.xml @@ -27,6 +27,7 @@ {{project.version}} 1.7.7 + 2.13.1 diff --git a/pf4j/pom.xml b/pf4j/pom.xml index dd8e519..c67e0f2 100644 --- a/pf4j/pom.xml +++ b/pf4j/pom.xml @@ -72,12 +72,6 @@ slf4j-api ${slf4j.version} - - org.slf4j - slf4j-log4j12 - ${slf4j.version} - test - com.github.zafarkhaja java-semver @@ -90,6 +84,26 @@ true + + + org.apache.logging.log4j + log4j-api + ${log4j.version} + test + + + org.apache.logging.log4j + log4j-core + ${log4j.version} + test + + + org.apache.logging.log4j + log4j-slf4j-impl + ${log4j.version} + test + + org.hamcrest diff --git a/pf4j/src/test/resources/log4j.properties b/pf4j/src/test/resources/log4j.properties deleted file mode 100644 index 7edd29c..0000000 --- a/pf4j/src/test/resources/log4j.properties +++ /dev/null @@ -1,20 +0,0 @@ -log4j.rootLogger=DEBUG, Console - -# -# PF4J log -# -log4j.logger.org.pf4j=DEBUG, Console -# !!! Put the bellow classes on level TRACE when you are in trouble -log4j.logger.org.pf4j.PluginClassLoader=WARN, Console -log4j.logger.org.pf4j.AbstractExtensionFinder=DEBUG, Console -log4j.additivity.org.pf4j=false -log4j.additivity.org.pf4j.PluginClassLoader=false -log4j.additivity.org.pf4j.AbstractExtensionFinder=false - -# -# Appenders -# -log4j.appender.Console=org.apache.log4j.ConsoleAppender -log4j.appender.Console.layout=org.apache.log4j.PatternLayout -#log4j.appender.Console.layout.conversionPattern=%-5p - %-32.32c{1} - %m\n -log4j.appender.Console.layout.ConversionPattern=%d %p %c - %m%n diff --git a/pf4j/src/test/resources/log4j2.properties b/pf4j/src/test/resources/log4j2.properties new file mode 100644 index 0000000..958b8d2 --- /dev/null +++ b/pf4j/src/test/resources/log4j2.properties @@ -0,0 +1,27 @@ +# +# Appenders +# +appender.console.type = Console +appender.console.name = console +appender.console.layout.type = PatternLayout +#appender.console.layout.pattern = %-5p - %-32.32c{1} - %m\n +appender.console.layout.pattern = %d %p %c - %m%n + +# +# Loggers +# + +# PF4J log +logger.pf4j.name = org.pf4j +logger.pf4j.level = debug +logger.pf4j.additivity = false +logger.pf4j.appenderRef.console.ref = console + +# !!! Uncomment below loggers when you are in trouble +#logger.loader.name = org.pf4j.PluginClassLoader +#logger.loader.level = trace +#logger.finder.name = org.pf4j.AbstractExtensionFinder +#logger.finder.level = trace + +rootLogger.level = debug +rootLogger.appenderRef.console.ref = console diff --git a/pom.xml b/pom.xml index b9b8879..2164e9b 100644 --- a/pom.xml +++ b/pom.xml @@ -46,6 +46,7 @@ 8 1.7.25 + 2.13.1 7.1 5.4.0 -- 2.39.5