From 0a37bcbba958e0499a29362f3813667ea3e7ae2c Mon Sep 17 00:00:00 2001 From: Tom Hombergs Date: Sat, 5 Jun 2021 07:50:27 +1000 Subject: [PATCH] add log4j example --- .github/workflows/ci.yml | 2 +- build-all.sh | 12 +++++- logging/log4j/pom.xml | 39 +++++++++++++++++++ .../src/main/java/io/reflectoring/Main.java | 17 ++++++++ logging/log4j/src/main/resources/log4j2.xml | 20 ++++++++++ 5 files changed, 88 insertions(+), 2 deletions(-) create mode 100644 logging/log4j/pom.xml create mode 100644 logging/log4j/src/main/java/io/reflectoring/Main.java create mode 100644 logging/log4j/src/main/resources/log4j2.xml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 591cc09..2a7fcf5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,7 +17,7 @@ jobs: matrix: # The MODULE environment variable is evaluated in build-all.sh to run a subset # of the builds. This way, multiple modules can be built in parallel. - module: [ "module1", "module2", "module3", "module4", "module5" ] + module: [ "module1", "module2", "module3", "module4", "module5", "module6" ] steps: diff --git a/build-all.sh b/build-all.sh index 79a8f83..48b8318 100755 --- a/build-all.sh +++ b/build-all.sh @@ -82,10 +82,20 @@ build_maven_module() { } } -if [[ "$MODULE" == "module5" ]] +if [[ "$MODULE" == "module6" ]] then # ADD NEW MODULES HERE # (add new modules above the rest so you get quicker feedback if it fails) + build_maven_module "logging/log4j" + + echo "" + echo "+++" + echo "+++ MODULE 6 SUCCESSFUL" + echo "+++" +fi + +if [[ "$MODULE" == "module5" ]] +then build_gradle_module "spring-boot/hazelcast/hazelcast-embedded-cache" build_gradle_module "spring-boot/hazelcast/hazelcast-client-server" build_maven_module "core-java/heapdump" diff --git a/logging/log4j/pom.xml b/logging/log4j/pom.xml new file mode 100644 index 0000000..82510fb --- /dev/null +++ b/logging/log4j/pom.xml @@ -0,0 +1,39 @@ + + + 4.0.0 + + io.reflectoring + logging-log4j + 1.0-SNAPSHOT + + + 11 + 11 + + + + + + org.apache.logging.log4j + log4j-api + 2.14.1 + + + org.apache.logging.log4j + log4j-core + 2.14.1 + + + org.apache.logging.log4j + log4j-slf4j-impl + 2.14.1 + + + io.logz.log4j2 + logzio-log4j2-appender + 1.0.12 + + + \ No newline at end of file diff --git a/logging/log4j/src/main/java/io/reflectoring/Main.java b/logging/log4j/src/main/java/io/reflectoring/Main.java new file mode 100644 index 0000000..4e97416 --- /dev/null +++ b/logging/log4j/src/main/java/io/reflectoring/Main.java @@ -0,0 +1,17 @@ +package io.reflectoring; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class Main { + + public static void main(String[] args) { + Logger logger = LoggerFactory.getLogger(Main.class); + + logger.debug("This is a debug message"); + logger.info("This is an info message"); + logger.warn("This is a warn message"); + logger.error("This is an error message"); + } + +} diff --git a/logging/log4j/src/main/resources/log4j2.xml b/logging/log4j/src/main/resources/log4j2.xml new file mode 100644 index 0000000..d7321d5 --- /dev/null +++ b/logging/log4j/src/main/resources/log4j2.xml @@ -0,0 +1,20 @@ + + + + + + + + + eoUyeKjGgqfrMGVWeZLfTyYCAmBTbhvh + https://listener.logz.io:8071 + java + + + + + + + + + \ No newline at end of file