summaryrefslogtreecommitdiff
path: root/example
diff options
context:
space:
mode:
authorMatthias Andreas Benkard <code@mail.matthias.benkard.de>2021-05-11 21:44:31 +0200
committerMatthias Andreas Benkard <code@mail.matthias.benkard.de>2021-05-11 21:49:32 +0200
commit78d803c91b604c93da8a63c767b1c9a87899fc8a (patch)
tree8e274d0d3396cb7caf1d213289d0d0e875e66bed /example
parent97931bae67ffa7d546f68df098dd226e11b48443 (diff)
Add example project.
Change-Id: I782efdfb2b97b7a876dff637da8bac533d681e9b
Diffstat (limited to 'example')
-rw-r--r--example/pom.xml44
-rw-r--r--example/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/example/RootResource.java36
-rw-r--r--example/src/main/resources/application.properties0
3 files changed, 80 insertions, 0 deletions
diff --git a/example/pom.xml b/example/pom.xml
new file mode 100644
index 0000000..c5c82b2
--- /dev/null
+++ b/example/pom.xml
@@ -0,0 +1,44 @@
+<?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>1.0.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>quarkus-googlecloud-jsonlogging-example</artifactId>
+ <name>Quarkus Google Cloud JSON Logging Extension - Example</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-resteasy</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>eu.mulk.quarkus-googlecloud-jsonlogging</groupId>
+ <artifactId>quarkus-googlecloud-jsonlogging</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>build</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/example/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/example/RootResource.java b/example/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/example/RootResource.java
new file mode 100644
index 0000000..6fa42cd
--- /dev/null
+++ b/example/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/example/RootResource.java
@@ -0,0 +1,36 @@
+package eu.mulk.quarkus.googlecloud.jsonlogging.example;
+
+import eu.mulk.quarkus.googlecloud.jsonlogging.KeyValueParameter;
+import eu.mulk.quarkus.googlecloud.jsonlogging.Label;
+import javax.annotation.PostConstruct;
+import javax.enterprise.context.ApplicationScoped;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import org.jboss.logging.Logger;
+import org.jboss.logging.MDC;
+
+@Produces("text/plain")
+@Path("/")
+@ApplicationScoped
+public class RootResource {
+
+ static final Logger log = Logger.getLogger(RootResource.class);
+
+ @PostConstruct
+ public void init() {
+ log.warn("Hey!");
+ }
+
+ @GET
+ public String hello() {
+ MDC.put("requestMethod", "GET");
+ log.infof(
+ "Hello %s.",
+ "Mulkiatsch",
+ KeyValueParameter.of("a", "b"),
+ Label.of("app", "foo"),
+ KeyValueParameter.of("version", 10));
+ throw new IllegalStateException();
+ }
+}
diff --git a/example/src/main/resources/application.properties b/example/src/main/resources/application.properties
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/example/src/main/resources/application.properties