Skip to content

Commit

Permalink
add sample log4j config to demo app (#523)
Browse files Browse the repository at this point in the history
Co-authored-by: Muhammad Noman <[email protected]>
Co-authored-by: Muzahidul Islam <[email protected]>
  • Loading branch information
3 people authored Sep 12, 2023
1 parent 6c5e5b2 commit ca2a894
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jsonSimpleVersion = 1.1.1
logbackVersion = 1.2.3
slf4jVersion = 1.7.30
httpClientVersion = 4.5.14
log4jVersion = 2.20.0

# Style Packages
findbugsAnnotationVersion = 3.0.1
Expand Down
14 changes: 8 additions & 6 deletions java-quickstart/build.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
apply plugin: 'java'

dependencies {
compile project(':core-api')
compile project(':core-httpclient-impl')
implementation project(':core-api')
implementation project(':core-httpclient-impl')

compile group: 'com.google.code.gson', name: 'gson', version: gsonVersion
compile group: 'org.apache.httpcomponents', name: 'httpclient', version: httpClientVersion
compile group: 'org.slf4j', name: 'slf4j-simple', version: slf4jVersion
implementation group: 'com.google.code.gson', name: 'gson', version: gsonVersion
implementation group: 'org.apache.httpcomponents', name: 'httpclient', version: httpClientVersion
implementation group: 'org.apache.logging.log4j', name: 'log4j-api', version: log4jVersion
implementation group: 'org.apache.logging.log4j', name: 'log4j-core', version: log4jVersion
implementation group: 'org.apache.logging.log4j', name: 'log4j-slf4j-impl', version: log4jVersion

testCompile group: 'junit', name: 'junit', version: '4.12'
testImplementation group: 'junit', name: 'junit', version: junitVersion
}

task runExample(type: JavaExec) {
Expand Down
10 changes: 10 additions & 0 deletions java-quickstart/src/main/resources/log4j2.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Set the root logger level to INFO and its appender to the console

appender.console.type = Console
appender.console.name = STDOUT
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n

# Specify the loggers
rootLogger.level = debug
rootLogger.appenderRef.stdout.ref = STDOUT

0 comments on commit ca2a894

Please sign in to comment.