Skip to content

Commit

Permalink
Upgraded to slf4j v2 (#39)
Browse files Browse the repository at this point in the history
* Upgraded to slf4j v2

* Improved github ci
  • Loading branch information
Hakky54 committed Feb 1, 2023
1 parent 3f69d78 commit ee9042a
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 18 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/maven.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: Build

on: [push, pull_request]
on:
push:
branches:
- master
pull_request:

jobs:
build:
Expand Down
45 changes: 30 additions & 15 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,23 @@
</distributionManagement>

<properties>
<!-- project properties -->
<version.java>1.8</version.java>
<version.logback>1.2.11</version.logback>
<version.junit>5.8.2</version.junit>
<version.assertj>3.22.0</version.assertj>
<version.mockito>4.5.1</version.mockito>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

<!-- dependency properties -->
<version.logback>1.3.5</version.logback>
<version.log4j>2.19.0</version.log4j>

<!-- test dependency properties -->
<version.junit>5.9.2</version.junit>
<version.assertj>3.24.2</version.assertj>
<version.mockito>4.11.0</version.mockito>
<version.lombok>1.18.24</version.lombok>
<version.jul-to-slf4j>1.7.36</version.jul-to-slf4j>
<version.slf4j-simple>1.7.36</version.slf4j-simple>
<version.apache.log4j-to-slf4j>2.17.2</version.apache.log4j-to-slf4j>
<version.slf4j>2.0.6</version.slf4j>
<version.log4j-over-slf4j>1.7.36</version.log4j-over-slf4j>
<version.log4j-slf4j-impl>2.17.2</version.log4j-slf4j-impl>

<!-- plugin properties -->
<version.jacoco-maven-plugin>0.8.5</version.jacoco-maven-plugin>
<version.maven-surefire-plugin>2.22.2</version.maven-surefire-plugin>
<version.maven-compiler-plugin>3.8.1</version.maven-compiler-plugin>
Expand All @@ -70,7 +76,6 @@
<version.maven-release-plugin>2.5.3</version.maven-release-plugin>
<version.maven-scm-publish-plugin>3.0.0</version.maven-scm-publish-plugin>
<version.nexus-staging-maven-plugin>1.6.8</version.nexus-staging-maven-plugin>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
Expand All @@ -82,12 +87,12 @@
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-to-slf4j</artifactId>
<version>${version.apache.log4j-to-slf4j}</version>
<version>${version.log4j}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jul-to-slf4j</artifactId>
<version>${version.jul-to-slf4j}</version>
<version>${version.slf4j}</version>
</dependency>

<dependency>
Expand Down Expand Up @@ -118,19 +123,19 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>${version.slf4j-simple}</version>
<version>${version.slf4j}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
<version>${version.log4j-over-slf4j}</version>
<version>${version.slf4j}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<version>${version.log4j-slf4j-impl}</version>
<artifactId>log4j-slf4j2-impl</artifactId>
<version>${version.log4j}</version>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -141,6 +146,16 @@
</dependency>
</dependencies>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${version.slf4j}</version>
</dependency>
</dependencies>
</dependencyManagement>

<build>
<plugins>
<plugin>
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/nl/altindag/log/LogCaptorShould.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
import org.mockito.MockedStatic;
import org.mockito.junit.jupiter.MockitoExtension;
import org.slf4j.LoggerFactory;
import org.slf4j.impl.SimpleLogger;
import org.slf4j.simple.SimpleLogger;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
Expand Down Expand Up @@ -448,7 +448,7 @@ void throwExceptionWhenLoggerImplementationIsNotLogback() {

assertThatThrownBy(LogCaptor::forRoot)
.isInstanceOf(IllegalArgumentException.class)
.hasMessage("SLF4J Logger implementation should be of the type [ch.qos.logback.classic.Logger] but found [org.slf4j.impl.SimpleLogger].");
.hasMessage("SLF4J Logger implementation should be of the type [ch.qos.logback.classic.Logger] but found [org.slf4j.simple.SimpleLogger].");
}
}

Expand Down

0 comments on commit ee9042a

Please sign in to comment.