From 663163d1c85f6f838221c1d79f888f597e1eed2c Mon Sep 17 00:00:00 2001 From: Matthias Andreas Benkard Date: Sun, 24 Sep 2023 13:46:22 +0200 Subject: feat(docs): Update documentation for version 6.1.0. Change-Id: I74abd4b17316a1a45c455b68530000645688d8cf --- README.adoc | 200 ++++++++++++++++----- examples/quarkus/pom.xml | 2 +- examples/spring-boot/pom.xml | 2 +- .../src/main/resources/logging.properties | 2 +- .../jsonlogging/runtime/package-info.java | 4 +- 5 files changed, 160 insertions(+), 50 deletions(-) diff --git a/README.adoc b/README.adoc index 3cadf3d..76f9eae 100644 --- a/README.adoc +++ b/README.adoc @@ -48,7 +48,7 @@ If you are using Maven: eu.mulk.quarkus-googlecloud-jsonlogging quarkus-googlecloud-jsonlogging - 6.0.0 + 6.1.0 @@ -59,7 +59,7 @@ If you are using Gradle: [source,groovy] ---- dependencies { - implementation("eu.mulk.quarkus-googlecloud-jsonlogging:quarkus-googlecloud-jsonlogging:6.0.0") + implementation("eu.mulk.quarkus-googlecloud-jsonlogging:quarkus-googlecloud-jsonlogging:6.1.0") } ---- @@ -72,6 +72,7 @@ in `application.properties`: quarkus.log.console.google = true ---- + == Activation (Other Frameworks) If you are not using Quarkus, you can still make use of the `-core` @@ -90,7 +91,7 @@ If you are using Maven: eu.mulk.quarkus-googlecloud-jsonlogging quarkus-googlecloud-jsonlogging-core - 6.0.0 + 6.1.0 @@ -101,74 +102,183 @@ If you are using Gradle: [source,groovy] ---- dependencies { - implementation("eu.mulk.quarkus-googlecloud-jsonlogging:quarkus-googlecloud-jsonlogging-core:6.0.0") + implementation("eu.mulk.quarkus-googlecloud-jsonlogging:quarkus-googlecloud-jsonlogging-core:6.1.0") } ---- -=== Wiring (Spring Boot) +=== Wiring (java.util.logging) -If you are using Spring Boot, the easiest way to integrate the log -formatter is by relying on `spring-boot-starter-logging` (which is -pulled in by `spring-boot-starter`), excluding Logback, and pulling in -JBoss Log Manager as the back end for SLF4J: +This section explains how to use JBoss Log Manager as the log manager +for `java.util.logging` and how to configure it to use the log +formatter provided by this library. + +Add a dependency on JBoss Log Manager and the `-core` module to your +project. + +If you are using Maven: [source,xml] ---- - eu.mulk.quarkus-googlecloud-jsonlogging quarkus-googlecloud-jsonlogging-core - 6.0.0 + 6.1.0 - org.jboss.slf4j - slf4j-jboss-logmanager - 1.1.0.Final - - - - org.springframework.boot - spring-boot-starter - - - ch.qos.logback - logback-classic - - + org.jboss.logmanager + jboss-logmanager + 3.0.2.Final ---- -Create a text file called -`META-INF/services/org.jboss.logmanager.EmbeddedConfigurator` in your -`resources` directory and put the fully qualified name of -`DefaultEmbeddedConfigurator` into it: +If you are using Gradle: + +[source,groovy] +---- +dependencies { + implementation("eu.mulk.quarkus-googlecloud-jsonlogging:quarkus-googlecloud-jsonlogging-core:6.1.0") + implementation("org.jboss.logmanager:jboss-logmanager:3.0.2.Final") +} +---- + +Create a text file called `org.jboss.logmanager.ConfiguratorFactory` +in your `resources/META-INF/services/` directory and put the fully +qualified name of this library's `DefaultConfiguratorFactory` into it: + +[source] +---- +eu.mulk.quarkus.googlecloud.jsonlogging.logmanager.DefaultConfiguratorFactory +---- + +Finally, set the `java.util.logging.manager` system property to +`org.jboss.logmanager.LogManager` when running your application: + +[source,shell] +---- +$ java -Djava.util.logging.manager=org.jboss.logmanager.LogManager ... +---- + + +=== Wiring (Spring Boot) + +If you are using Spring Boot, the easiest way to integrate the log +formatter is by relying on `spring-boot-starter-logging` (which is +pulled in by `spring-boot-starter`), excluding Logback, and pulling in +JBoss Log Manager as the back end for SLF4J. In addition, configure +JBoss Log Manager as the log manager for `java.util.logging` by +setting the `java.util.logging.manager` system property to +`org.jboss.logmanager.LogManager`. + +If you are using Maven: + +[source,xml] +---- + + + + + + eu.mulk.quarkus-googlecloud-jsonlogging + quarkus-googlecloud-jsonlogging-core + 6.1.0 + + + + org.jboss.slf4j + slf4j-jboss-logmanager + 2.0.1.Final + + + + org.jboss.logmanager + jboss-logmanager + 3.0.2.Final + + + + org.springframework.boot + spring-boot-starter + + + ch.qos.logback + logback-classic + + + + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + ${spring-boot.version} + + + org.jboss.logmanager.LogManager + + + + + + + + +---- + +If you are using Gradle: + +[source,groovy] +---- +configurations { + all*.exclude(group: "ch.qos.logback", module: "logback-classic") +} + +dependencies { + implementation("eu.mulk.quarkus-googlecloud-jsonlogging:quarkus-googlecloud-jsonlogging-core:6.1.0") + implementation("org.jboss.logmanager:jboss-logmanager:3.0.2.Final") + implementation("org.jboss.slf4j:slf4j-jboss-logmanager:2.0.1.Final") +} + +tasks.named("bootRun") { + systemProperty("java.util.logging.manager", "org.jboss.logmanager.LogManager") +} +---- + +Create a text file called `org.jboss.logmanager.ConfiguratorFactory` +in your `resources/META-INF/services/` directory and put the fully +qualified name of this library's `DefaultConfiguratorFactory` into it: [source] ---- -eu.mulk.quarkus.googlecloud.jsonlogging.logmanager.DefaultEmbeddedConfigurator +eu.mulk.quarkus.googlecloud.jsonlogging.logmanager.DefaultConfiguratorFactory ---- -To configure `java.util.logging`, which is used by Tomcat by default, -create an entry in `application.properties` that points to -`logging.properties`: +Because Spring Boot configures the system logger with a minimum log +level of `SEVERE` by default, you may also want to configure the +logger using a `logging.properties` file. To do so, first add an +entry to `application.properties` that points to the file: [source,properties] ---- logging.config = classpath:logging.properties ---- -Create the `logging.properties` file in your `resources` directory and -name `DefaultConsoleHandler` as a handler: +Finally, create the `logging.properties` file in your `resources` +directory and set the root logger level to something other than +`SEVERE`: [source,properties] ---- -handlers = eu.mulk.quarkus.googlecloud.jsonlogging.logmanager.DefaultConsoleHandler +logger.level = INFO ---- @@ -178,28 +288,28 @@ Logging unstructured data requires no code changes. All logs are automatically converted to Google-Cloud-Logging-compatible JSON. Structured data can be logged in one of 3 different ways: by passing -https://javadocs.dev/eu.mulk.quarkus-googlecloud-jsonlogging/quarkus-googlecloud-jsonlogging-core/6.0.0/eu.mulk.quarkus.googlecloud.jsonlogging.core/eu/mulk/quarkus/googlecloud/jsonlogging/Label.html[Label]s +https://javadocs.dev/eu.mulk.quarkus-googlecloud-jsonlogging/quarkus-googlecloud-jsonlogging-core/6.1.0/eu.mulk.quarkus.googlecloud.jsonlogging.core/eu/mulk/quarkus/googlecloud/jsonlogging/Label.html[Label]s and -https://javadocs.dev/eu.mulk.quarkus-googlecloud-jsonlogging/quarkus-googlecloud-jsonlogging-core/6.0.0/eu.mulk.quarkus.googlecloud.jsonlogging.core/eu/mulk/quarkus/googlecloud/jsonlogging/StructuredParameter.html[StructuredParameter]s +https://javadocs.dev/eu.mulk.quarkus-googlecloud-jsonlogging/quarkus-googlecloud-jsonlogging-core/6.1.0/eu.mulk.quarkus.googlecloud.jsonlogging.core/eu/mulk/quarkus/googlecloud/jsonlogging/StructuredParameter.html[StructuredParameter]s as parameters to individual log entries, by supplying -https://javadocs.dev/eu.mulk.quarkus-googlecloud-jsonlogging/quarkus-googlecloud-jsonlogging-core/6.0.0/eu.mulk.quarkus.googlecloud.jsonlogging.core/eu/mulk/quarkus/googlecloud/jsonlogging/LabelProvider.html[LabelProvider]s +https://javadocs.dev/eu.mulk.quarkus-googlecloud-jsonlogging/quarkus-googlecloud-jsonlogging-core/6.1.0/eu.mulk.quarkus.googlecloud.jsonlogging.core/eu/mulk/quarkus/googlecloud/jsonlogging/LabelProvider.html[LabelProvider]s and -https://javadocs.dev/eu.mulk.quarkus-googlecloud-jsonlogging/quarkus-googlecloud-jsonlogging-core/6.0.0/eu.mulk.quarkus.googlecloud.jsonlogging.core/eu/mulk/quarkus/googlecloud/jsonlogging/StructuredParameterProvider.html[StructuredParameterProvider]s, +https://javadocs.dev/eu.mulk.quarkus-googlecloud-jsonlogging/quarkus-googlecloud-jsonlogging-core/6.1.0/eu.mulk.quarkus.googlecloud.jsonlogging.core/eu/mulk/quarkus/googlecloud/jsonlogging/StructuredParameterProvider.html[StructuredParameterProvider]s, or by using the Mapped Diagnostic Context. === Using Label and StructuredParameter Instances of -https://javadocs.dev/eu.mulk.quarkus-googlecloud-jsonlogging/quarkus-googlecloud-jsonlogging-core/6.0.0/eu.mulk.quarkus.googlecloud.jsonlogging.core/eu/mulk/quarkus/googlecloud/jsonlogging/Label.html[Label] +https://javadocs.dev/eu.mulk.quarkus-googlecloud-jsonlogging/quarkus-googlecloud-jsonlogging-core/6.1.0/eu.mulk.quarkus.googlecloud.jsonlogging.core/eu/mulk/quarkus/googlecloud/jsonlogging/Label.html[Label] and -https://javadocs.dev/eu.mulk.quarkus-googlecloud-jsonlogging/quarkus-googlecloud-jsonlogging-core/6.0.0/eu.mulk.quarkus.googlecloud.jsonlogging.core/eu/mulk/quarkus/googlecloud/jsonlogging/StructuredParameter.html[StructuredParameter] +https://javadocs.dev/eu.mulk.quarkus-googlecloud-jsonlogging/quarkus-googlecloud-jsonlogging-core/6.1.0/eu.mulk.quarkus.googlecloud.jsonlogging.core/eu/mulk/quarkus/googlecloud/jsonlogging/StructuredParameter.html[StructuredParameter] can be passed as log parameters to the `*f` family of logging functions on JBoss Logging's https://docs.jboss.org/jbosslogging/latest/org/jboss/logging/Logger.html[Logger]. Simple key–value pairs are represented by -https://javadocs.dev/eu.mulk.quarkus-googlecloud-jsonlogging/quarkus-googlecloud-jsonlogging-core/6.0.0/eu.mulk.quarkus.googlecloud.jsonlogging.core/eu/mulk/quarkus/googlecloud/jsonlogging/KeyValueParameter.html[KeyValueParameter]. +https://javadocs.dev/eu.mulk.quarkus-googlecloud-jsonlogging/quarkus-googlecloud-jsonlogging-core/6.1.0/eu.mulk.quarkus.googlecloud.jsonlogging.core/eu/mulk/quarkus/googlecloud/jsonlogging/KeyValueParameter.html[KeyValueParameter]. **Example:** @@ -234,9 +344,9 @@ Result: === Using LabelProvider and StructuredParameterProvider Any CDI beans that implement -https://javadocs.dev/eu.mulk.quarkus-googlecloud-jsonlogging/quarkus-googlecloud-jsonlogging-core/6.0.0/eu.mulk.quarkus.googlecloud.jsonlogging.core/eu/mulk/quarkus/googlecloud/jsonlogging/LabelProvider.html[LabelProvider] +https://javadocs.dev/eu.mulk.quarkus-googlecloud-jsonlogging/quarkus-googlecloud-jsonlogging-core/6.1.0/eu.mulk.quarkus.googlecloud.jsonlogging.core/eu/mulk/quarkus/googlecloud/jsonlogging/LabelProvider.html[LabelProvider] and -https://javadocs.dev/eu.mulk.quarkus-googlecloud-jsonlogging/quarkus-googlecloud-jsonlogging-core/6.0.0/eu.mulk.quarkus.googlecloud.jsonlogging.core/eu/mulk/quarkus/googlecloud/jsonlogging/StructuredParameterProvider.html[StructuredParameterProvider] +https://javadocs.dev/eu.mulk.quarkus-googlecloud-jsonlogging/quarkus-googlecloud-jsonlogging-core/6.1.0/eu.mulk.quarkus.googlecloud.jsonlogging.core/eu/mulk/quarkus/googlecloud/jsonlogging/StructuredParameterProvider.html[StructuredParameterProvider] are discovered at build time and consulted to provide labels and parameters for each message that is logged. This can be used to provide contextual information such as tracing and request IDs stored diff --git a/examples/quarkus/pom.xml b/examples/quarkus/pom.xml index 25e4f8b..70c923e 100644 --- a/examples/quarkus/pom.xml +++ b/examples/quarkus/pom.xml @@ -14,7 +14,7 @@ SPDX-License-Identifier: GPL-3.0-or-later eu.mulk.quarkus-googlecloud-jsonlogging quarkus-googlecloud-jsonlogging-parent - 6.0.0 + 6.1.0 quarkus-googlecloud-jsonlogging-quarkus-example diff --git a/examples/spring-boot/pom.xml b/examples/spring-boot/pom.xml index 8cb994a..4f893b7 100644 --- a/examples/spring-boot/pom.xml +++ b/examples/spring-boot/pom.xml @@ -16,7 +16,7 @@ SPDX-License-Identifier: GPL-3.0-or-later eu.mulk.quarkus-googlecloud-jsonlogging quarkus-googlecloud-jsonlogging-parent - 6.0.0 + 6.1.0 quarkus-googlecloud-jsonlogging-spring-boot-example diff --git a/examples/spring-boot/src/main/resources/logging.properties b/examples/spring-boot/src/main/resources/logging.properties index 8bc0033..ba75dff 100644 --- a/examples/spring-boot/src/main/resources/logging.properties +++ b/examples/spring-boot/src/main/resources/logging.properties @@ -2,7 +2,7 @@ # # SPDX-License-Identifier: GPL-3.0-or-later -# java.util.logging properties +# java.util.logging properties (not used) #handlers = eu.mulk.quarkus.googlecloud.jsonlogging.logmanager.DefaultConsoleHandler #.level = INFO diff --git a/runtime/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/runtime/package-info.java b/runtime/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/runtime/package-info.java index 5df9885..a1b8e9c 100644 --- a/runtime/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/runtime/package-info.java +++ b/runtime/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/runtime/package-info.java @@ -43,7 +43,7 @@ * * eu.mulk.quarkus-googlecloud-jsonlogging * quarkus-googlecloud-jsonlogging - * 6.0.0 + * 6.1.0 * * * ... @@ -59,7 +59,7 @@ * dependencies { * // ... * - * implementation("eu.mulk.quarkus-googlecloud-jsonlogging:quarkus-googlecloud-jsonlogging:6.0.0") + * implementation("eu.mulk.quarkus-googlecloud-jsonlogging:quarkus-googlecloud-jsonlogging:6.1.0") * * // ... * } -- cgit v1.2.3