Skip to content

Commit

Permalink
Merge pull request #9 from wg1026688210/pr
Browse files Browse the repository at this point in the history
add properties config example.
  • Loading branch information
dubasdey authored Sep 25, 2024
2 parents 05194c6 + 7b23b85 commit 53ff2a9
Show file tree
Hide file tree
Showing 4 changed files with 112 additions and 0 deletions.
5 changes: 5 additions & 0 deletions examples/propertyConf/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
target/
.settings/
.project
.classpath
.factorypath
81 changes: 81 additions & 0 deletions examples/propertyConf/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.github.dubasdey</groupId>
<artifactId>log4j2-jsonevent-layout-example-property-conf</artifactId>
<version>0.0.1</version>
<name>log4j2-jsonevent-layout</name>
<description>Log4j2 JSON Event layout properties config example</description>
<url>https://github.com/dubasdey/log4j2-jsonevent-layout</url>

<licenses>
<license>
<name>GNU LGPL v3</name>
<url>https://www.gnu.org/licenses/lgpl-3.0.en.html</url>
<distribution>repo</distribution>
</license>
</licenses>

<scm>
<url>https://github.com/dubasdey/log4j2-jsonevent-layout</url>
<connection>scm:git:git://github.com/dubasdey/log4j2-jsonevent-layout.git</connection>
<developerConnection>scm:git:git@github.com:dubasdey/log4j2-jsonevent-layout.git</developerConnection>
</scm>

<properties>
<java.version>8</java.version>
<maven.compiler.source>8</maven.compiler.source>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>ossrh</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>

<developers>
<developer>
<id>erodriguez</id>
<name>Eduardo Rodríguez</name>
<email>eduardo@rodriguezcarro.es</email>
</developer>
</developers>

<dependencies>

<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.17.1</version>
</dependency>

<dependency>
<groupId>com.github.dubasdey</groupId>
<artifactId>log4j2-jsonevent-layout</artifactId>
<version>0.0.7</version>
</dependency>

</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<encoding>utf-8</encoding>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package org.erc.log4j2.layout.examples.basic;


import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

public class Main {

private static final Logger logger = LogManager.getLogger(Main.class);

public static void main(String[] args){
logger.info("Debug line");
}
}
12 changes: 12 additions & 0 deletions examples/propertyConf/src/main/resources/log4j2.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
rootLogger.level = DEBUG
rootLogger.appenderRef.console.ref = STDOUT

appender.console.type = Console
appender.console.name = STDOUT
appender.console.target=SYSTEM_OUT
appender.console.layout.type = JSONLog4j2Layout
appender.console.layout.singleLine = true
appender.console.layout.locationInfo = true
appender.console.layout.xxx.type = UserField
appender.console.layout.xxx.key = jobId
appender.console.layout.xxx.value = 111

0 comments on commit 53ff2a9

Please sign in to comment.