From 1b5764239115611e092c1c5f70d036ecf673898a Mon Sep 17 00:00:00 2001 From: Yurii Bidiuk Date: Mon, 15 Aug 2022 21:47:15 +0300 Subject: [PATCH] Use LOG4J2 to wrap connectors logs to JSON format --- airbyte-integrations/bases/base-java/build.gradle | 1 + .../main/resources/AirbyteLogMessageTemplate.json | 13 +++++++++++++ .../bases/base-java/src/main/resources/log4j2.xml | 14 ++++++++++++++ 3 files changed, 28 insertions(+) create mode 100644 airbyte-integrations/bases/base-java/src/main/resources/AirbyteLogMessageTemplate.json create mode 100644 airbyte-integrations/bases/base-java/src/main/resources/log4j2.xml diff --git a/airbyte-integrations/bases/base-java/build.gradle b/airbyte-integrations/bases/base-java/build.gradle index 69abe73589c3..f3a90f553338 100644 --- a/airbyte-integrations/bases/base-java/build.gradle +++ b/airbyte-integrations/bases/base-java/build.gradle @@ -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' } diff --git a/airbyte-integrations/bases/base-java/src/main/resources/AirbyteLogMessageTemplate.json b/airbyte-integrations/bases/base-java/src/main/resources/AirbyteLogMessageTemplate.json new file mode 100644 index 000000000000..95cb9aa986f3 --- /dev/null +++ b/airbyte-integrations/bases/base-java/src/main/resources/AirbyteLogMessageTemplate.json @@ -0,0 +1,13 @@ +{ + "type": "LOG", + "log": { + "level": { + "$resolver": "level", + "field": "name" + }, + "message": { + "$resolver": "message", + "stringified": true + } + } +} diff --git a/airbyte-integrations/bases/base-java/src/main/resources/log4j2.xml b/airbyte-integrations/bases/base-java/src/main/resources/log4j2.xml new file mode 100644 index 000000000000..81e76194de83 --- /dev/null +++ b/airbyte-integrations/bases/base-java/src/main/resources/log4j2.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + +