Skip to content

Commit

Permalink
Use LOG4J2 to wrap connectors logs to JSON format
Browse files Browse the repository at this point in the history
  • Loading branch information
yurii-bidiuk committed Aug 19, 2022
1 parent a3a6501 commit 1b57642
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions airbyte-integrations/bases/base-java/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ dependencies {
implementation files(project(':airbyte-integrations:bases:base').airbyteDocker.outputs)

testImplementation 'commons-lang:commons-lang:2.6'
implementation group: 'org.apache.logging.log4j', name: 'log4j-layout-template-json', version: '2.17.2'
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"type": "LOG",
"log": {
"level": {
"$resolver": "level",
"field": "name"
},
"message": {
"$resolver": "message",
"stringified": true
}
}
}
14 changes: 14 additions & 0 deletions airbyte-integrations/bases/base-java/src/main/resources/log4j2.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="INFO">

<Appenders>
<Console name="ConsoleJSONAppender" target="SYSTEM_OUT">
<JsonTemplateLayout eventTemplateUri="classpath:AirbyteLogMessageTemplate.json"/>
</Console>
</Appenders>
<Loggers>
<Root level="INFO" additivity="false">
<AppenderRef ref="ConsoleJSONAppender"/>
</Root>
</Loggers>
</Configuration>

0 comments on commit 1b57642

Please sign in to comment.