From e8007b5f1af2d8ef72b3ac893afcf391cb0cea84 Mon Sep 17 00:00:00 2001 From: Kirill Gevorkyan <26010098+kgevorkyan@users.noreply.github.com> Date: Thu, 23 Dec 2021 15:06:16 +0700 Subject: [PATCH] Update diktat-analysis configs and migrate to log4j2 (#1156) ### What's done: * Update diktat-analysis configs and migrate to log4j2 --- diktat-common/pom.xml | 10 ++++++++-- diktat-common/src/main/resources/log4j.properties | 6 ------ diktat-common/src/main/resources/log4j2.properties | 8 ++++++++ diktat-rules/pom.xml | 10 ++++++++-- .../src/main/resources/diktat-analysis-huawei.yml | 2 +- diktat-rules/src/main/resources/diktat-analysis.yml | 2 +- diktat-rules/src/main/resources/log4j.properties | 6 ------ diktat-rules/src/main/resources/log4j2.properties | 8 ++++++++ diktat-test-framework/pom.xml | 10 ++++++++-- .../src/main/resources/log4j.properties | 6 ------ .../src/main/resources/log4j2.properties | 8 ++++++++ examples/gradle-groovy-dsl/diktat-analysis.yml | 2 +- .../diktat-analysis.yml | 2 +- examples/gradle-kotlin-dsl/diktat-analysis.yml | 2 +- examples/maven/diktat-analysis.yml | 2 +- pom.xml | 11 ++++++++--- 16 files changed, 62 insertions(+), 33 deletions(-) delete mode 100644 diktat-common/src/main/resources/log4j.properties create mode 100644 diktat-common/src/main/resources/log4j2.properties delete mode 100644 diktat-rules/src/main/resources/log4j.properties create mode 100644 diktat-rules/src/main/resources/log4j2.properties delete mode 100644 diktat-test-framework/src/main/resources/log4j.properties create mode 100644 diktat-test-framework/src/main/resources/log4j2.properties diff --git a/diktat-common/pom.xml b/diktat-common/pom.xml index 9743ca418c..39935aab6f 100644 --- a/diktat-common/pom.xml +++ b/diktat-common/pom.xml @@ -36,8 +36,14 @@ slf4j-api - org.slf4j - slf4j-log4j12 + org.apache.logging.log4j + log4j-core + 2.17.0 + + + org.apache.logging.log4j + log4j-slf4j-impl + 2.17.0 org.junit.jupiter diff --git a/diktat-common/src/main/resources/log4j.properties b/diktat-common/src/main/resources/log4j.properties deleted file mode 100644 index 4f6ddb5e3d..0000000000 --- a/diktat-common/src/main/resources/log4j.properties +++ /dev/null @@ -1,6 +0,0 @@ -log4j.rootLogger = INFO,stdout - -log4j.appender.stdout = org.apache.log4j.ConsoleAppender -log4j.appender.stdout.Target = System.out -log4j.appender.stdout.layout = org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern = [%-5p] %d{yyyy-MM-dd HH:mm:ss} %m%n diff --git a/diktat-common/src/main/resources/log4j2.properties b/diktat-common/src/main/resources/log4j2.properties new file mode 100644 index 0000000000..20bfdb44d6 --- /dev/null +++ b/diktat-common/src/main/resources/log4j2.properties @@ -0,0 +1,8 @@ +rootLogger.level = info +rootLogger.appenderRef.stdout.ref = STDOUT + +appender.stdout.type = Console +appender.stdout.name = STDOUT +appender.stdout.target = SYSTEM_OUT +appender.stdout.layout.type = PatternLayout +appender.stdout.layout.pattern = [%-5p] %d{yyyy-MM-dd HH:mm:ss} %m%n \ No newline at end of file diff --git a/diktat-rules/pom.xml b/diktat-rules/pom.xml index aecf46d0fb..5ee7cc78c3 100644 --- a/diktat-rules/pom.xml +++ b/diktat-rules/pom.xml @@ -55,8 +55,14 @@ slf4j-api - org.slf4j - slf4j-log4j12 + org.apache.logging.log4j + log4j-core + 2.17.0 + + + org.apache.logging.log4j + log4j-slf4j-impl + 2.17.0 org.junit.jupiter diff --git a/diktat-rules/src/main/resources/diktat-analysis-huawei.yml b/diktat-rules/src/main/resources/diktat-analysis-huawei.yml index 4fad2669f5..f9b02b4d66 100644 --- a/diktat-rules/src/main/resources/diktat-analysis-huawei.yml +++ b/diktat-rules/src/main/resources/diktat-analysis-huawei.yml @@ -138,7 +138,7 @@ enabled: true configuration: isCopyrightMandatory: true - copyrightText: ' Copyright (c) Huawei Technologies Co., Ltd. 2012-2021. All rights reserved.' + copyrightText: ' Copyright (c) Huawei Technologies Co., Ltd. 2012-;@currYear;. All rights reserved.' # Checks that header kdoc is located before package directive - name: HEADER_NOT_BEFORE_PACKAGE enabled: true diff --git a/diktat-rules/src/main/resources/diktat-analysis.yml b/diktat-rules/src/main/resources/diktat-analysis.yml index 328db72ddc..8577ad31b3 100644 --- a/diktat-rules/src/main/resources/diktat-analysis.yml +++ b/diktat-rules/src/main/resources/diktat-analysis.yml @@ -138,7 +138,7 @@ enabled: true configuration: isCopyrightMandatory: false - copyrightText: 'Copyright (c) Your Company Name Here. 2010-2021' + copyrightText: 'Copyright (c) Your Company Name Here. 2010-;@currYear;' # Checks that header kdoc is located before package directive - name: HEADER_NOT_BEFORE_PACKAGE enabled: true diff --git a/diktat-rules/src/main/resources/log4j.properties b/diktat-rules/src/main/resources/log4j.properties deleted file mode 100644 index 4f6ddb5e3d..0000000000 --- a/diktat-rules/src/main/resources/log4j.properties +++ /dev/null @@ -1,6 +0,0 @@ -log4j.rootLogger = INFO,stdout - -log4j.appender.stdout = org.apache.log4j.ConsoleAppender -log4j.appender.stdout.Target = System.out -log4j.appender.stdout.layout = org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern = [%-5p] %d{yyyy-MM-dd HH:mm:ss} %m%n diff --git a/diktat-rules/src/main/resources/log4j2.properties b/diktat-rules/src/main/resources/log4j2.properties new file mode 100644 index 0000000000..bcb53d4eba --- /dev/null +++ b/diktat-rules/src/main/resources/log4j2.properties @@ -0,0 +1,8 @@ +rootLogger.level = info +rootLogger.appenderRef.stdout.ref = STDOUT + +appender.stdout.type = Console +appender.stdout.name = STDOUT +appender.stdout.target = SYSTEM_OUT +appender.stdout.layout.type = PatternLayout +appender.stdout.layout.pattern = [%-5p] %d{yyyy-MM-dd HH:mm:ss} %m%n diff --git a/diktat-test-framework/pom.xml b/diktat-test-framework/pom.xml index 1042df3506..e3cc4594d9 100644 --- a/diktat-test-framework/pom.xml +++ b/diktat-test-framework/pom.xml @@ -35,8 +35,14 @@ slf4j-api - org.slf4j - slf4j-log4j12 + org.apache.logging.log4j + log4j-core + 2.17.0 + + + org.apache.logging.log4j + log4j-slf4j-impl + 2.17.0 io.github.petertrr diff --git a/diktat-test-framework/src/main/resources/log4j.properties b/diktat-test-framework/src/main/resources/log4j.properties deleted file mode 100644 index 4f6ddb5e3d..0000000000 --- a/diktat-test-framework/src/main/resources/log4j.properties +++ /dev/null @@ -1,6 +0,0 @@ -log4j.rootLogger = INFO,stdout - -log4j.appender.stdout = org.apache.log4j.ConsoleAppender -log4j.appender.stdout.Target = System.out -log4j.appender.stdout.layout = org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern = [%-5p] %d{yyyy-MM-dd HH:mm:ss} %m%n diff --git a/diktat-test-framework/src/main/resources/log4j2.properties b/diktat-test-framework/src/main/resources/log4j2.properties new file mode 100644 index 0000000000..20bfdb44d6 --- /dev/null +++ b/diktat-test-framework/src/main/resources/log4j2.properties @@ -0,0 +1,8 @@ +rootLogger.level = info +rootLogger.appenderRef.stdout.ref = STDOUT + +appender.stdout.type = Console +appender.stdout.name = STDOUT +appender.stdout.target = SYSTEM_OUT +appender.stdout.layout.type = PatternLayout +appender.stdout.layout.pattern = [%-5p] %d{yyyy-MM-dd HH:mm:ss} %m%n \ No newline at end of file diff --git a/examples/gradle-groovy-dsl/diktat-analysis.yml b/examples/gradle-groovy-dsl/diktat-analysis.yml index 328db72ddc..8577ad31b3 100644 --- a/examples/gradle-groovy-dsl/diktat-analysis.yml +++ b/examples/gradle-groovy-dsl/diktat-analysis.yml @@ -138,7 +138,7 @@ enabled: true configuration: isCopyrightMandatory: false - copyrightText: 'Copyright (c) Your Company Name Here. 2010-2021' + copyrightText: 'Copyright (c) Your Company Name Here. 2010-;@currYear;' # Checks that header kdoc is located before package directive - name: HEADER_NOT_BEFORE_PACKAGE enabled: true diff --git a/examples/gradle-kotlin-dsl-multiproject/diktat-analysis.yml b/examples/gradle-kotlin-dsl-multiproject/diktat-analysis.yml index 65601b3d43..bfcb7825fc 100644 --- a/examples/gradle-kotlin-dsl-multiproject/diktat-analysis.yml +++ b/examples/gradle-kotlin-dsl-multiproject/diktat-analysis.yml @@ -83,7 +83,7 @@ enabled: true configuration: isCopyrightMandatory: true - copyrightText: 'Copyright (c) Your Company Name Here. 2010-2021' + copyrightText: 'Copyright (c) Your Company Name Here. 2010-;@currYear;' - name: HEADER_NOT_BEFORE_PACKAGE enabled: true - name: FILE_IS_TOO_LONG diff --git a/examples/gradle-kotlin-dsl/diktat-analysis.yml b/examples/gradle-kotlin-dsl/diktat-analysis.yml index 328db72ddc..8577ad31b3 100644 --- a/examples/gradle-kotlin-dsl/diktat-analysis.yml +++ b/examples/gradle-kotlin-dsl/diktat-analysis.yml @@ -138,7 +138,7 @@ enabled: true configuration: isCopyrightMandatory: false - copyrightText: 'Copyright (c) Your Company Name Here. 2010-2021' + copyrightText: 'Copyright (c) Your Company Name Here. 2010-;@currYear;' # Checks that header kdoc is located before package directive - name: HEADER_NOT_BEFORE_PACKAGE enabled: true diff --git a/examples/maven/diktat-analysis.yml b/examples/maven/diktat-analysis.yml index 328db72ddc..8577ad31b3 100644 --- a/examples/maven/diktat-analysis.yml +++ b/examples/maven/diktat-analysis.yml @@ -138,7 +138,7 @@ enabled: true configuration: isCopyrightMandatory: false - copyrightText: 'Copyright (c) Your Company Name Here. 2010-2021' + copyrightText: 'Copyright (c) Your Company Name Here. 2010-;@currYear;' # Checks that header kdoc is located before package directive - name: HEADER_NOT_BEFORE_PACKAGE enabled: true diff --git a/pom.xml b/pom.xml index d9052e7955..f64f264c32 100644 --- a/pom.xml +++ b/pom.xml @@ -134,9 +134,14 @@ ${slf4j.version} - org.slf4j - slf4j-log4j12 - ${slf4j.version} + org.apache.logging.log4j + log4j-core + 2.17.0 + + + org.apache.logging.log4j + log4j-slf4j-impl + 2.17.0 io.github.petertrr