Skip to content

Commit

Permalink
feat: allow platform logs to be json format (#14889)
Browse files Browse the repository at this point in the history
  • Loading branch information
abuchanan-airbyte committed Dec 20, 2024
1 parent 34453b4 commit 91daf07
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ class AirbyteLogbackCustomConfigurer :
appenders.forEach { addAppender(it) }
}

// Disable noise from Jooq. https://github.com/jOOQ/jOOQ/issues/4019
loggerContext.getLogger("org.jooq.Constants").level = Level.OFF

// Do not allow any other configurators to run after this.
// This prevents Logback from creating the default console appender for the root logger.
return Configurator.ExecutionStatus.DO_NOT_INVOKE_NEXT_IF_ANY
Expand Down Expand Up @@ -148,7 +151,12 @@ class AirbyteLogbackCustomConfigurer :
internal fun createPlatformAppender(loggerContext: LoggerContext): ConsoleAppender<ILoggingEvent> =
ConsoleAppender<ILoggingEvent>().apply {
context = loggerContext
encoder = createUnstructuredEncoder(context = loggerContext, layout = AirbytePlatformLogbackMessageLayout())
encoder =
if (EnvVar.PLATFORM_LOG_FORMAT.fetchNotNull().lowercase() == "json") {
AirbyteLogEventEncoder().apply { start() }
} else {
createUnstructuredEncoder(context = loggerContext, layout = AirbytePlatformLogbackMessageLayout())
}
name = PLATFORM_LOGGER_NAME
start()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ enum class EnvVar {
OTEL_COLLECTOR_ENDPOINT,

PATH_TO_CONNECTORS,

PLATFORM_LOG_FORMAT,
PUBLISH_METRICS,
PUB_SUB_ENABLED,
PUB_SUB_TOPIC_NAME,
Expand Down

0 comments on commit 91daf07

Please sign in to comment.