From 561212eb4375769e316a10c9d8d4cd03e6fd6d8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Mal=C3=A9=C5=99?= Date: Mon, 15 Apr 2024 14:30:11 +0200 Subject: [PATCH] Applying the QE feedback to the Logging guide MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michal Maléř --- docs/src/main/asciidoc/logging.adoc | 31 +++++++++++-------- .../json/runtime/AdditionalFieldConfig.java | 2 +- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/docs/src/main/asciidoc/logging.adoc b/docs/src/main/asciidoc/logging.adoc index 0f6ab858131f0..84bef6c0cc3d1 100644 --- a/docs/src/main/asciidoc/logging.adoc +++ b/docs/src/main/asciidoc/logging.adoc @@ -74,6 +74,7 @@ The same flow can be applied with any of the <>. - -Configure the runtime logging in the `application.properties` file. +JBoss Logging, integrated into Quarkus, offers a unified configuration for all <> through a single configuration file that sets up all available extensions. +To adjust runtime logging, modify the `application.properties` file. .An example of how you can set the default log level to `INFO` logging and include Hibernate `DEBUG` logs: [source, properties] @@ -347,9 +349,9 @@ The logging format string supports the following symbols: |%t|Thread name|Render the thread name. |%t{id}|Thread ID|Render the thread ID. |%z{}|Time zone|Set the time zone of the output to ``. -|%X{}|Mapped Diagnostic Context Value|Renders the value from Mapped Diagnostic Context -|%X|Mapped Diagnostic Context Values|Renders all the values from Mapped Diagnostic Context in format {property.key=property.value} -|%x|Nested Diagnostics context values|Renders all the values from Nested Diagnostics Context in format {value1.value2} +|%X{}|Mapped Diagnostic Context Value|Renders the value from Mapped Diagnostic Context. +|%X|Mapped Diagnostic Context Values|Renders all the values from Mapped Diagnostic Context in format `{property.key=property.value}`. +|%x|Nested Diagnostics context values|Renders all the values from Nested Diagnostics Context in format `{value1.value2}`. |=== @@ -364,8 +366,8 @@ Changing the console log format is useful, for example, when the console output The `quarkus-logging-json` extension may be employed to add support for the JSON logging format and its related configuration. -Add this extension to your build file as the following snippet illustrates: - +. Add this extension to your build file as the following snippet illustrates: ++ [source,xml,role="primary asciidoc-tabs-target-sync-cli asciidoc-tabs-target-sync-maven"] .pom.xml ---- @@ -374,20 +376,21 @@ Add this extension to your build file as the following snippet illustrates: quarkus-logging-json ---- - ++ [source,gradle,role="secondary asciidoc-tabs-target-sync-gradle"] .build.gradle ---- implementation("io.quarkus:quarkus-logging-json") ---- - ++ By default, the presence of this extension replaces the output format configuration from the console configuration, and the format string and the color settings (if any) are ignored. The other console configuration items, including those controlling asynchronous logging and the log level, will continue to be applied. - ++ For some, it will make sense to use humanly readable (unstructured) logging in dev mode and JSON logging (structured) in production mode. This can be achieved using different profiles, as shown in the following configuration. - -.Disable JSON logging in application.properties for dev and test mode ++ +. Disable JSON logging in application.properties for dev and test mode: ++ [source, properties] ---- %dev.quarkus.log.console.json=false @@ -514,6 +517,8 @@ To register a logging filter: .An example of writing a filter: [source,java] ---- +package com.example; + import io.quarkus.logging.LoggingFilter; import java.util.logging.Filter; import java.util.logging.LogRecord; diff --git a/extensions/logging-json/runtime/src/main/java/io/quarkus/logging/json/runtime/AdditionalFieldConfig.java b/extensions/logging-json/runtime/src/main/java/io/quarkus/logging/json/runtime/AdditionalFieldConfig.java index ec95d7fb5a59c..dba33ea8e0d72 100644 --- a/extensions/logging-json/runtime/src/main/java/io/quarkus/logging/json/runtime/AdditionalFieldConfig.java +++ b/extensions/logging-json/runtime/src/main/java/io/quarkus/logging/json/runtime/AdditionalFieldConfig.java @@ -16,7 +16,7 @@ public class AdditionalFieldConfig { /** * Additional field type specification. - * Supported types: string, int, long + * Supported types: {@code string}, {@code int}, and {@code long}. * String is the default if not specified. */ @ConfigItem(defaultValue = "string")