8000 changed logger from log4j2 to logback by chairz · Pull Request #1 · binance/binance-connector-java · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

changed logger from log4j2 to logback #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## 1.1.0 - 2021-12-10

### Changed
- log4j2 logger to logback.

## 1.0.1 - 2021-12-08

### Added
Expand Down
21 changes: 5 additions & 16 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>io.github.binance</groupId>
<artifactId>binance-connector-java</artifactId>
<version>1.0.1</version>
<version>1.1.0</version>
<packaging>jar</packaging>
<name>${project.groupId}:${project.artifactId}</name>
<description>lightweight connector to API</description>
Expand All @@ -23,7 +23,6 @@
</repository>
</distributionManagement>


<licenses>
<license>
<name>MIT License</name>
Expand Down Expand Up @@ -112,7 +111,6 @@
</executions>
</plugin>
</plugins>

</build>

<properties>
Expand Down Expand Up @@ -146,20 +144,11 @@
<artifactId>slf4j-api</artifactId>
<version>1.7.32</version>
</dependency>
<!-- Replacing log4j2 due to: https://logging.apache.org/log4j/2.x/security.html -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<version>2.14.1</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.14.1</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.14.1</version>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.7</version>
</dependency>
<dependency>
<groupId>junit</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.binance.connector.logging.util;

import ch.qos.logback.classic.pattern.ClassicConverter;
import ch.qos.logback.classic.spi.ILoggingEvent;

public class MsEpochConverter extends ClassicConverter {

@Override
public String convert(ILoggingEvent e) {
return Long.toString(e.getTimeStamp());
}
}

33 changes: 0 additions & 33 deletions src/main/resources/log4j2.xml

This file was deleted.

41 changes: 41 additions & 0 deletions src/main/resources/logback.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<configuration>
<conversionRule conversionWord="epoch"
converterClass="com.binance.connector.logging.util.MsEpochConverter" />

<property name="SYSTEM" value="binance-java-connector" />
<property name="LOG_PATTERN" value="%date{yyyy-MM-dd HH:mm:ss.SSS}[%epoch] | %-5level | %-10thread{10} | %-36logger{36} - %msg%n" />
<property name="BASE_DIR" value="./logs" />
<property name="OLD_DIR" value="${SYSTEM}" />
<property name="FILE_NAME" value="${SYSTEM}.log" />


<appender name="stdout" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${LOG_PATTERN}</pattern>
</encoder>
</appender>

<appender name="dailyFile" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${BASE_DIR}/${FILE_NAME}</file>
<append>true</append>
<encoder>
<pattern>${LOG_PATTERN}</pattern>
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${BASE_DIR}/${OLD_DIR}/${FILE_NAME}.%d{yyyy-MM-dd}.gz</fileNamePattern>
<maxHistory>30</maxHistory>
</rollingPolicy>
</appender>

<appender name="dailyFileAsync" class="ch.qos.logback.classic.AsyncAppender">
<queueSize>1000000</queueSize>
<discardingThreshold>0</discardingThreshold>
<appender-ref ref="dailyFile" />
</appender>

<root level="INFO">
<appender-ref ref="stdout" />
<appender-ref ref="dailyFileAsync" />
</root>
</configuration>

0