Skip to content

Commit

Permalink
Merge pull request #57 from monarch-initiative/fix_logger
Browse files Browse the repository at this point in the history
decided to use logback with slf4j
  • Loading branch information
leokim-l authored Sep 2, 2024
2 parents 329324e + c5d385b commit 2fd4d9f
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 36 deletions.
36 changes: 13 additions & 23 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -163,20 +163,11 @@
<version>5.9.2</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/ch.qos.logback/logback-classic -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>2.0.13</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.23.1</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<version>2.23.1</version>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.5.6</version>
</dependency>
</dependencies>
</dependencyManagement>
Expand Down Expand Up @@ -237,17 +228,10 @@
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/ch.qos.logback/logback-classic -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</dependency>
</dependencies>

Expand Down Expand Up @@ -370,6 +354,12 @@
<generateBackupPoms>false</generateBackupPoms>
</configuration>
</plugin>
<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-dependency-plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.7.1</version>
</plugin>
</plugins>
</build>
</project>
13 changes: 0 additions & 13 deletions src/main/resources/log4j2.xml

This file was deleted.

40 changes: 40 additions & 0 deletions src/main/resources/logback.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
# Console appender
<!-- appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<layout class="ch.qos.logback.classic.PatternLayout">
# Pattern of log message for console appender
<Pattern>%d{yyyy-MM-dd HH:mm:ss} %-5p %m%n</Pattern>
</layout>
</appender-->

# Rolling File appender
<property name="LOG_FILE" value="ppkt2prompt" />
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<layout class="ch.qos.logback.classic.PatternLayout">
# Pattern of log message for console appender
<Pattern>%d{yyyy-MM-dd HH:mm:ss} %-5p %m%n</Pattern>
</layout>
<file>${LOG_FILE}.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- daily rollover -->
<fileNamePattern>${LOG_FILE}.%d{yyyy-MM-dd}.gz</fileNamePattern>

<!-- keep 30 days' worth of history capped at 1GB total size -->
<maxHistory>30</maxHistory>
<totalSizeCap>1GB</totalSizeCap>
</rollingPolicy>
<encoder>
<pattern>%-4relative [%thread] %-5level %logger{35} - %msg%n</pattern>
</encoder>
</appender>

# Override log level for specified package
<!-- logger name="" level="TRACE"/ -->

<root level="INFO">
<!--appender-ref ref="STDOUT" /-->
<appender-ref ref="FILE" />
</root>
</configuration>

0 comments on commit 2fd4d9f

Please sign in to comment.