Since the beginning of our open source engagement (and my personal java life), we’ve been working with log4j. By that time, log4j was de-facto standard in the JAVA world. However, it’s time to say Goodbye to an old friend and move on to SLF4J.
So what does that mean in concrete? Switching the logging version is a lot of hustle since you not only have to rewrite the imports and the logger declarations, but also repackage everything in central, and, in case of distributeme-generator, change code generation code, that is not that easy to track with an IDE. However, what we’ve done so far:
- ano-util 2.1.0
- ano-db 2.1.0
- ano-net 2.1.0
- ano-tags 2.1.0
- ano-prise 2.1.0
- ano-maf 2.1.0
- moskito 2.3.0
- distributeme 2.1.0 (on the way).
We decided to increase a major version number (mid-number) because the logger change can lead to incompatibility (for example, some ano-util classes expect logger as parameter), so everyone knows, this update can break things. A bit.
What changed
All the libs now include SLF4J:
<dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> </dependency>
For testing purposes they also include logback references:
<dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-classic</artifactId> <scope>test</scope> </dependency>
Projects that are standalone applications, like moskito-minimal or distributeme-registry, also contain logback at runtime and a logback.xml as configuration.
And you?
If you want to use one of our libs with the logging framework of your choice, simply consult the slf4j manual and choose your binding.
Log on.