Skip to content

Instantly share code, notes, and snippets.

@jottinger
Created November 3, 2021 14:20
Show Gist options
  • Save jottinger/76d3f225556e8719bb3e079d85d89c66 to your computer and use it in GitHub Desktop.
Save jottinger/76d3f225556e8719bb3e079d85d89c66 to your computer and use it in GitHub Desktop.
tilerendering
package p1;
import org.slf4j.LoggerFactory;
public class Main {
public static void main(String[] args) {
var logger= LoggerFactory.getLogger(Main.class);
System.out.println(logger.getClass());
}
}
With profile1, output is:
class org.slf4j.impl.JDK14LoggerAdapter
With profile2, output is:
class ch.qos.logback.classic.Logger
With neither profile, output is, including stderr:
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
class org.slf4j.helpers.NOPLogger
<?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>org.example</groupId>
<artifactId>tilerendering</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.32</version>
</dependency>
</dependencies>
<profiles>
<profile>
<id>profile1</id>
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
<version>[1.5,1.7.9)</version>
</dependency>
</dependencies>
</profile>
<profile>
<id>profile2</id>
<dependencies>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.6</version>
</dependency>
</dependencies>
</profile>
</profiles>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment