Skip to content

Commit

Permalink
replace log4j with slf4j and logback
Browse files Browse the repository at this point in the history
unfortunately spring-boot hard code support for an older slf4j and logback, but this is isolated in scenario
  • Loading branch information
cwensel committed Jan 15, 2025
1 parent b0c5622 commit 347408a
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 80 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ dependencies {

val slf4j = "2.0.16"
implementation("org.slf4j:slf4j-api:$slf4j")
implementation("org.slf4j:slf4j-reload4j:$slf4j")

val logback = "1.5.16"
implementation("ch.qos.logback:logback-classic:$logback")
implementation("ch.qos.logback:logback-core:$logback")
Expand All @@ -122,9 +122,10 @@ dependencies {
implementation("org.apache.logging.log4j:log4j-api:$log4j")
implementation("org.apache.logging.log4j:log4j-core:$log4j")
implementation("org.apache.logging.log4j:log4j-jul:$log4j")
implementation("org.apache.logging.log4j:log4j-slf4j-impl:$log4j")
implementation("org.apache.logging.log4j:log4j-slf4j2-impl:$log4j")
implementation("org.apache.logging.log4j:log4j-to-slf4j:$log4j")
implementation("org.apache.logging.log4j:log4j-web:$log4j")
implementation("org.apache.logging.log4j:log4j-layout-template-json:$log4j")

implementationAndTestFixture("com.jayway.jsonpath:json-path:2.9.0")
implementationAndTestFixture("com.google.guava:guava:33.4.0-jre")
Expand Down Expand Up @@ -190,7 +191,6 @@ dependencies {

testImplementationAndTestFixture("ch.qos.logback:logback-classic:$logback")
testImplementationAndTestFixture("ch.qos.logback:logback-core:$logback")
testImplementationAndTestFixture("org.slf4j:slf4j-reload4j:$slf4j")
}
}

Expand Down
23 changes: 0 additions & 23 deletions clusterless-substrate-aws-lambda-arc/src/main/resources/log4j2.xml

This file was deleted.

12 changes: 4 additions & 8 deletions clusterless-substrate-aws-lambda-common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ dependencies {
api(project(":clusterless-substrate-aws-lambda-common-model"))

implementation("com.google.guava:guava")
// implementation("com.cronutils:cron-utils")

implementation("com.fasterxml.jackson.core:jackson-core")
implementation("com.fasterxml.jackson.core:jackson-databind")
Expand All @@ -30,14 +29,11 @@ dependencies {
api("software.amazon.awssdk:eventbridge")
api("software.amazon.awssdk:glue")

// https://docs.aws.amazon.com/lambda/latest/dg/java-logging.html#java-logging-log4j2
api("com.amazonaws:aws-lambda-java-core")
api("com.amazonaws:aws-lambda-java-log4j2") {
exclude("org.apache.logging.log4j")
exclude("log4j:log4j")
exclude("org.slf4j:slf4j-log4j12")
}

implementation("org.slf4j:slf4j-reload4j")
api("com.amazonaws:aws-lambda-java-log4j2")
implementation("org.apache.logging.log4j:log4j-slf4j2-impl")
implementation("org.apache.logging.log4j:log4j-layout-template-json")

testFixturesImplementation(project(":clusterless-common"))
testFixturesImplementation(project(":clusterless-model"))
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<!--
~ Copyright (c) 2023-2025 Chris K Wensel <[email protected]>. All Rights Reserved.
~
~ This Source Code Form is subject to the terms of the Mozilla Public
~ License, v. 2.0. If a copy of the MPL was not distributed with this
~ file, You can obtain one at http://mozilla.org/MPL/2.0/.
-->

<Configuration>
<Appenders>
<Lambda name="Lambda" format="${env:AWS_LAMBDA_LOG_FORMAT:-TEXT}">
<LambdaTextFormat>
<PatternLayout>
<pattern>%d{yyyy-MM-dd HH:mm:ss} %X{AWSRequestId} %-5p %c{1} - %m%n</pattern>
</PatternLayout>
</LambdaTextFormat>
<LambdaJSONFormat>
<JsonTemplateLayout eventTemplateUri="classpath:LambdaLayout.json"/>
</LambdaJSONFormat>
</Lambda>
</Appenders>
<Loggers>
<Root level="${env:AWS_LAMBDA_LOG_LEVEL:-INFO}">
<AppenderRef ref="Lambda"/>
</Root>
<Logger name="software.amazon.awssdk" level="WARN"/>
<Logger name="software.amazon.awssdk.request" level="INFO"/>
</Loggers>
</Configuration>

This file was deleted.

This file was deleted.

0 comments on commit 347408a

Please sign in to comment.