diff options
-rw-r--r-- | README.adoc | 4 | ||||
-rw-r--r-- | core/pom.xml | 48 | ||||
-rw-r--r-- | core/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/Formatter.java (renamed from runtime/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/Formatter.java) | 0 | ||||
-rw-r--r-- | core/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/KeyValueParameter.java (renamed from runtime/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/KeyValueParameter.java) | 0 | ||||
-rw-r--r-- | core/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/Label.java (renamed from runtime/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/Label.java) | 0 | ||||
-rw-r--r-- | core/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/LabelProvider.java (renamed from runtime/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/LabelProvider.java) | 6 | ||||
-rw-r--r-- | core/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/LogEntry.java (renamed from runtime/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/LogEntry.java) | 0 | ||||
-rw-r--r-- | core/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/StructuredParameter.java (renamed from runtime/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/StructuredParameter.java) | 0 | ||||
-rw-r--r-- | core/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/StructuredParameterProvider.java (renamed from runtime/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/StructuredParameterProvider.java) | 6 | ||||
-rw-r--r-- | core/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/package-info.java (renamed from runtime/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/package-info.java) | 29 | ||||
-rw-r--r-- | deployment/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/deployment/GoogleCloudLoggingProcessor.java | 2 | ||||
-rw-r--r-- | example/pom.xml | 2 | ||||
-rw-r--r-- | pom.xml | 8 | ||||
-rw-r--r-- | runtime/pom.xml | 9 | ||||
-rw-r--r-- | runtime/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/runtime/GoogleCloudJsonLoggingRecorder.java (renamed from runtime/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/GoogleCloudJsonLoggingRecorder.java) | 5 | ||||
-rw-r--r-- | runtime/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/runtime/package-info.java | 71 |
16 files changed, 165 insertions, 25 deletions
diff --git a/README.adoc b/README.adoc index 44ccb4a..79407cf 100644 --- a/README.adoc +++ b/README.adoc @@ -49,7 +49,7 @@ automatically registers itself on startup. <dependency> <groupId>eu.mulk.quarkus-googlecloud-jsonlogging</groupId> <artifactId>quarkus-googlecloud-jsonlogging</artifactId> - <version>3.1.0</version> + <version>4.0.0</version> </dependency> ... @@ -67,7 +67,7 @@ automatically registers itself on startup. dependencies { ... - implementation("eu.mulk.quarkus-googlecloud-jsonlogging:quarkus-googlecloud-jsonlogging:3.1.0") + implementation("eu.mulk.quarkus-googlecloud-jsonlogging:quarkus-googlecloud-jsonlogging:4.0.0") ... } diff --git a/core/pom.xml b/core/pom.xml new file mode 100644 index 0000000..86656ae --- /dev/null +++ b/core/pom.xml @@ -0,0 +1,48 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>eu.mulk.quarkus-googlecloud-jsonlogging</groupId> + <artifactId>quarkus-googlecloud-jsonlogging-parent</artifactId> + <version>3.1.4-SNAPSHOT</version> + </parent> + + <artifactId>quarkus-googlecloud-jsonlogging-core</artifactId> + <name>Quarkus Google Cloud JSON Logging Extension - JBoss Logging Core</name> + + <dependencies> + <dependency> + <groupId>org.jboss.logmanager</groupId> + <artifactId>jboss-logmanager-embedded</artifactId> + </dependency> + <dependency> + <groupId>io.smallrye.common</groupId> + <artifactId>smallrye-common-constraint</artifactId> + </dependency> + <dependency> + <groupId>org.glassfish</groupId> + <artifactId>jakarta.json</artifactId> + </dependency> + </dependencies> + + <build> + <plugins> + + <plugin> + <artifactId>maven-jar-plugin</artifactId> + <configuration> + <archive> + <manifestEntries> + <Automatic-Module-Name>eu.mulk.quarkus.googlecloud.jsonlogging.core</Automatic-Module-Name> + </manifestEntries> + </archive> + </configuration> + </plugin> + + </plugins> + </build> + +</project> diff --git a/runtime/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/Formatter.java b/core/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/Formatter.java index 066f709..066f709 100644 --- a/runtime/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/Formatter.java +++ b/core/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/Formatter.java diff --git a/runtime/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/KeyValueParameter.java b/core/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/KeyValueParameter.java index a5924b4..a5924b4 100644 --- a/runtime/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/KeyValueParameter.java +++ b/core/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/KeyValueParameter.java diff --git a/runtime/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/Label.java b/core/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/Label.java index 33664dd..33664dd 100644 --- a/runtime/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/Label.java +++ b/core/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/Label.java diff --git a/runtime/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/LabelProvider.java b/core/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/LabelProvider.java index dbd035c..8cf87db 100644 --- a/runtime/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/LabelProvider.java +++ b/core/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/LabelProvider.java @@ -5,7 +5,11 @@ import java.util.Collection; /** * A user-supplied provider for {@link Label}s. * - * <p>Any CDI beans registered under this class are applied to each log entry that is logged. + * <p>Instances of this interface that are registered with the {@link Formatter} are applied to each + * log entry that is logged. + * + * <p>If you are using the Quarkus extension, any CDI beans registered under this interface are + * registered automatically. * * <p><strong>Example:</strong> * diff --git a/runtime/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/LogEntry.java b/core/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/LogEntry.java index d108c81..d108c81 100644 --- a/runtime/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/LogEntry.java +++ b/core/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/LogEntry.java diff --git a/runtime/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/StructuredParameter.java b/core/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/StructuredParameter.java index c718080..c718080 100644 --- a/runtime/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/StructuredParameter.java +++ b/core/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/StructuredParameter.java diff --git a/runtime/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/StructuredParameterProvider.java b/core/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/StructuredParameterProvider.java index cacfea6..decf937 100644 --- a/runtime/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/StructuredParameterProvider.java +++ b/core/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/StructuredParameterProvider.java @@ -3,7 +3,11 @@ package eu.mulk.quarkus.googlecloud.jsonlogging; /** * A user-supplied provider for {@link StructuredParameter}s. * - * <p>Any CDI beans registered under this class are applied to each log entry that is logged. + * <p>Instances of this interface that are registered with the {@link Formatter} are applied to each + * log entry that is logged. + * + * <p>If you are using the Quarkus extension, any CDI beans registered under this interface are + * registered automatically. * * <p><strong>Example:</strong> * diff --git a/runtime/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/package-info.java b/core/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/package-info.java index 110ab73..2f4c7ce 100644 --- a/runtime/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/package-info.java +++ b/core/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/package-info.java @@ -17,17 +17,17 @@ * <p>It is possible to log unstructured text, structured data, or a mixture of both depending on * the situation. * - * <h2 id="sect-activation">Activation</h2> + * <h2 id="sect-activation">Installation</h2> * * <ul> - * <li><a href="#sect-activation-maven">Activation with Maven</a> - * <li><a href="#sect-activation-gradle">Activation with Gradle</a> + * <li><a href="#sect-installation-maven">Installation with Maven</a> + * <li><a href="#sect-installation-gradle">Installation with Gradle</a> * </ul> * * <p>Add the runtime POM to your dependency list. As long as the JAR is on the classpath at both * build time and runtime, the log formatter automatically registers itself on startup. * - * <h3 id="sect-activation-maven">Activation with Maven</h3> + * <h3 id="sect-installation-maven">Installation with Maven</h3> * * <pre>{@code * <project> @@ -38,8 +38,8 @@ * * <dependency> * <groupId>eu.mulk.quarkus-googlecloud-jsonlogging</groupId> - * <artifactId>quarkus-googlecloud-jsonlogging</artifactId> - * <version>3.1.0</version> + * <artifactId>quarkus-googlecloud-jsonlogging-core</artifactId> + * <version>4.0.0</version> * </dependency> * * ... @@ -49,13 +49,13 @@ * </project> * }</pre> * - * <h3 id="sect-activation-gradle">Activation with Gradle</h3> + * <h3 id="sect-installation-gradle">Installation with Gradle</h3> * * <pre>{@code * dependencies { * ... * - * implementation("eu.mulk.quarkus-googlecloud-jsonlogging:quarkus-googlecloud-jsonlogging:3.1.0") + * implementation("eu.mulk.quarkus-googlecloud-jsonlogging:quarkus-googlecloud-jsonlogging-core:4.0.0") * * ... * } @@ -117,11 +117,14 @@ * * <h3 id="sect-usage-provider">Using LabelProvider and StructuredParameterProvider</h3> * - * <p>Any CDI beans that implement {@link eu.mulk.quarkus.googlecloud.jsonlogging.LabelProvider}s - * and {@link eu.mulk.quarkus.googlecloud.jsonlogging.StructuredParameterProvider}s 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 in - * thread-local storage. + * <p>If you pass {@link eu.mulk.quarkus.googlecloud.jsonlogging.LabelProvider}s and {@link + * eu.mulk.quarkus.googlecloud.jsonlogging.StructuredParameterProvider}s to {@link + * eu.mulk.quarkus.googlecloud.jsonlogging.Formatter}, then they are 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 in thread-local storage. + * + * <p>If you are using the Quarkus extension, CDI beans that implement these interfaces are + * automatically detected at build time and passed to the formatter on startup. * * <p><strong>Example:</strong> * diff --git a/deployment/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/deployment/GoogleCloudLoggingProcessor.java b/deployment/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/deployment/GoogleCloudLoggingProcessor.java index aea89b9..668128f 100644 --- a/deployment/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/deployment/GoogleCloudLoggingProcessor.java +++ b/deployment/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/deployment/GoogleCloudLoggingProcessor.java @@ -1,6 +1,6 @@ package eu.mulk.quarkus.googlecloud.jsonlogging.deployment; -import eu.mulk.quarkus.googlecloud.jsonlogging.GoogleCloudJsonLoggingRecorder; +import eu.mulk.quarkus.googlecloud.jsonlogging.runtime.GoogleCloudJsonLoggingRecorder; import io.quarkus.deployment.annotations.BuildStep; import io.quarkus.deployment.annotations.ExecutionTime; import io.quarkus.deployment.annotations.Record; diff --git a/example/pom.xml b/example/pom.xml index c5c82b2..546a47c 100644 --- a/example/pom.xml +++ b/example/pom.xml @@ -7,7 +7,7 @@ <parent> <groupId>eu.mulk.quarkus-googlecloud-jsonlogging</groupId> <artifactId>quarkus-googlecloud-jsonlogging-parent</artifactId> - <version>1.0.0-SNAPSHOT</version> + <version>3.1.4-SNAPSHOT</version> </parent> <artifactId>quarkus-googlecloud-jsonlogging-example</artifactId> @@ -41,6 +41,7 @@ </scm> <modules> + <module>core</module> <module>deployment</module> <module>runtime</module> </modules> @@ -54,12 +55,13 @@ <compiler-plugin.version>3.8.1</compiler-plugin.version> <failsafe-plugin.version>${surefire-plugin.version}</failsafe-plugin.version> - <jar-plugin.version>3.2.0</jar-plugin.version> + <google-java-format.version>1.13.0</google-java-format.version> + <jar-plugin.version>3.2.2</jar-plugin.version> <maven-gpg-plugin.version>1.5</maven-gpg-plugin.version> <maven-javadoc-plugin.version>3.2.0</maven-javadoc-plugin.version> <maven-source-plugin.version>2.2.1</maven-source-plugin.version> <nexus-staging-plugin.version>1.6.8</nexus-staging-plugin.version> - <spotless-plugin.version>2.11.0</spotless-plugin.version> + <spotless-plugin.version>2.19.0</spotless-plugin.version> <surefire-plugin.version>3.0.0-M5</surefire-plugin.version> <quarkus.version>1.13.3.Final</quarkus.version> @@ -147,7 +149,7 @@ <order>java,javax,org,com,de,io,dagger,eu.mulk,</order> </importOrder> <googleJavaFormat> - <version>${google.java.format.version}</version> + <version>${google-java-format.version}</version> <style>GOOGLE</style> </googleJavaFormat> </java> diff --git a/runtime/pom.xml b/runtime/pom.xml index 01c2c2c..beb4bcc 100644 --- a/runtime/pom.xml +++ b/runtime/pom.xml @@ -15,6 +15,12 @@ <dependencies> <dependency> + <groupId>eu.mulk.quarkus-googlecloud-jsonlogging</groupId> + <artifactId>quarkus-googlecloud-jsonlogging-core</artifactId> + <version>${project.version}</version> + </dependency> + + <dependency> <groupId>io.quarkus</groupId> <artifactId>quarkus-arc</artifactId> </dependency> @@ -63,11 +69,10 @@ <plugin> <artifactId>maven-jar-plugin</artifactId> - <version>${jar-plugin.version}</version> <configuration> <archive> <manifestEntries> - <Automatic-Module-Name>eu.mulk.quarkus.googlecloud.jsonlogging</Automatic-Module-Name> + <Automatic-Module-Name>eu.mulk.quarkus.googlecloud.jsonlogging.runtime</Automatic-Module-Name> </manifestEntries> </archive> </configuration> diff --git a/runtime/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/GoogleCloudJsonLoggingRecorder.java b/runtime/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/runtime/GoogleCloudJsonLoggingRecorder.java index 7234a71..661b69f 100644 --- a/runtime/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/GoogleCloudJsonLoggingRecorder.java +++ b/runtime/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/runtime/GoogleCloudJsonLoggingRecorder.java @@ -1,5 +1,8 @@ -package eu.mulk.quarkus.googlecloud.jsonlogging; +package eu.mulk.quarkus.googlecloud.jsonlogging.runtime; +import eu.mulk.quarkus.googlecloud.jsonlogging.Formatter; +import eu.mulk.quarkus.googlecloud.jsonlogging.LabelProvider; +import eu.mulk.quarkus.googlecloud.jsonlogging.StructuredParameterProvider; import io.quarkus.arc.Arc; import io.quarkus.runtime.RuntimeValue; import io.quarkus.runtime.annotations.Recorder; 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 new file mode 100644 index 0000000..2fa7499 --- /dev/null +++ b/runtime/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/runtime/package-info.java @@ -0,0 +1,71 @@ +/** + * Provides structured logging to standard output according to the Google Cloud Logging + * specification. + * + * <ul> + * <li><a href="#sect-summary">Summary</a> + * <li><a href="#sect-activation">Activation</a> + * <li><a href="#sect-usage">Usage</a> + * </ul> + * + * <h2 id="sect-summary">Summary</h2> + * + * <p>This package contains a log formatter for JBoss Logging in the form of a Quarkus plugin that + * implements the <a href="https://cloud.google.com/logging/docs/structured-logging">Google Cloud + * Logging JSON format</a> on standard output. + * + * <p>It is possible to log unstructured text, structured data, or a mixture of both depending on + * the situation. + * + * <h2 id="sect-activation">Activation</h2> + * + * <ul> + * <li><a href="#sect-activation-maven">Activation with Maven</a> + * <li><a href="#sect-activation-gradle">Activation with Gradle</a> + * </ul> + * + * <p>Add the runtime POM to your dependency list. As long as the JAR is on the classpath at both + * build time and runtime, the log formatter automatically registers itself on startup. + * + * <h3 id="sect-activation-maven">Activation with Maven</h3> + * + * <pre>{@code + * <project> + * ... + * + * <dependencies> + * ... + * + * <dependency> + * <groupId>eu.mulk.quarkus-googlecloud-jsonlogging</groupId> + * <artifactId>quarkus-googlecloud-jsonlogging</artifactId> + * <version>4.0.0</version> + * </dependency> + * + * ... + * </dependencies> + * + * ... + * </project> + * }</pre> + * + * <h3 id="sect-activation-gradle">Activation with Gradle</h3> + * + * <pre>{@code + * dependencies { + * ... + * + * implementation("eu.mulk.quarkus-googlecloud-jsonlogging:quarkus-googlecloud-jsonlogging:4.0.0") + * + * ... + * } + * }</pre> + * + * <h2 id="sect-usage">Usage</h2> + * + * <p>See the documentation of the {@link eu.mulk.quarkus.googlecloud.jsonlogging} package for usage + * instructions. + * + * @see eu.mulk.quarkus.googlecloud.jsonlogging + */ +package eu.mulk.quarkus.googlecloud.jsonlogging.runtime; |