Skip to content

Commit 0a37bcb

Browse files
committed
add log4j example
1 parent dbdd4d2 commit 0a37bcb

5 files changed

Lines changed: 88 additions & 2 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
matrix:
1818
# The MODULE environment variable is evaluated in build-all.sh to run a subset
1919
# of the builds. This way, multiple modules can be built in parallel.
20-
module: [ "module1", "module2", "module3", "module4", "module5" ]
20+
module: [ "module1", "module2", "module3", "module4", "module5", "module6" ]
2121

2222
steps:
2323

build-all.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,20 @@ build_maven_module() {
8282
}
8383
}
8484

85-
if [[ "$MODULE" == "module5" ]]
85+
if [[ "$MODULE" == "module6" ]]
8686
then
8787
# ADD NEW MODULES HERE
8888
# (add new modules above the rest so you get quicker feedback if it fails)
89+
build_maven_module "logging/log4j"
90+
91+
echo ""
92+
echo "+++"
93+
echo "+++ MODULE 6 SUCCESSFUL"
94+
echo "+++"
95+
fi
96+
97+
if [[ "$MODULE" == "module5" ]]
98+
then
8999
build_gradle_module "spring-boot/hazelcast/hazelcast-embedded-cache"
90100
build_gradle_module "spring-boot/hazelcast/hazelcast-client-server"
91101
build_maven_module "core-java/heapdump"

logging/log4j/pom.xml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<groupId>io.reflectoring</groupId>
8+
<artifactId>logging-log4j</artifactId>
9+
<version>1.0-SNAPSHOT</version>
10+
11+
<properties>
12+
<maven.compiler.source>11</maven.compiler.source>
13+
<maven.compiler.target>11</maven.compiler.target>
14+
</properties>
15+
16+
17+
<dependencies>
18+
<dependency>
19+
<groupId>org.apache.logging.log4j</groupId>
20+
<artifactId>log4j-api</artifactId>
21+
<version>2.14.1</version>
22+
</dependency>
23+
<dependency>
24+
<groupId>org.apache.logging.log4j</groupId>
25+
<artifactId>log4j-core</artifactId>
26+
<version>2.14.1</version>
27+
</dependency>
28+
<dependency>
29+
<groupId>org.apache.logging.log4j</groupId>
30+
<artifactId>log4j-slf4j-impl</artifactId>
31+
<version>2.14.1</version>
32+
</dependency>
33+
<dependency>
34+
<groupId>io.logz.log4j2</groupId>
35+
<artifactId>logzio-log4j2-appender</artifactId>
36+
<version>1.0.12</version>
37+
</dependency>
38+
</dependencies>
39+
</project>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package io.reflectoring;
2+
3+
import org.slf4j.Logger;
4+
import org.slf4j.LoggerFactory;
5+
6+
public class Main {
7+
8+
public static void main(String[] args) {
9+
Logger logger = LoggerFactory.getLogger(Main.class);
10+
11+
logger.debug("This is a debug message");
12+
logger.info("This is an info message");
13+
logger.warn("This is a warn message");
14+
logger.error("This is an error message");
15+
}
16+
17+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Configuration status="WARN">
3+
4+
<Appenders>
5+
<Console name="CONSOLE" target="SYSTEM_OUT">
6+
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
7+
</Console>
8+
<LogzioAppender name="LOGZIO">
9+
<logzioToken>eoUyeKjGgqfrMGVWeZLfTyYCAmBTbhvh</logzioToken>
10+
<logzioUrl>https://listener.logz.io:8071</logzioUrl>
11+
<logzioType>java</logzioType>
12+
</LogzioAppender>
13+
</Appenders>
14+
15+
<Loggers>
16+
<Root level="INFO">
17+
<AppenderRef ref="${env:LOG_APPENDER:-CONSOLE}"/>
18+
</Root>
19+
</Loggers>
20+
</Configuration>

0 commit comments

Comments
 (0)