Skip to content

Commit

Permalink
Added log4j logging
Browse files Browse the repository at this point in the history
  • Loading branch information
sebhofmann committed Oct 30, 2024
1 parent 93936e8 commit 0b77565
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ target/
!**/src/main/**/target/
!**/src/test/**/target/
data/
logs/
spring-shell.log

### STS ###
Expand Down
10 changes: 10 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-log4j2</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
Expand Down
24 changes: 24 additions & 0 deletions src/main/resources/log4j2.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration status="off">
<appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{ISO8601} %-5p %X{loginId} %c{1}: %m%n%ex" />
</Console>
<RollingFile name="RollingFile" fileName="logs/importer-app.log"
filePattern="logs/$${date:yyyy-MM}/importerapp-%d{MM-dd-yyyy}-%i.log.gz">
<PatternLayout>
<Pattern>%highlight{%d{ISO8601} %-5p %X{loginId} %c{1}: %m%n%ex}</Pattern>
</PatternLayout>
<Policies>
<TimeBasedTriggeringPolicy />
<SizeBasedTriggeringPolicy size="250 MB"/>
</Policies>
</RollingFile>
</appenders>
<loggers>
<root level="info">
<appender-ref ref="Console" />
<appender-ref ref="RollingFile" />
</root>
</loggers>
</configuration>

0 comments on commit 0b77565

Please sign in to comment.