I have a large web project that uses log4j directly, together with many 3rd-party libraries and a mix of logging libraries.
- our code base – uses log4j directly.
- Hibernate – uses slf4j, and the slf4j-log4j binding.
- Spring – uses commons-loggings. Thus, it uses the jcl-over-slf4j bridge api, slf4j itself, and slf4j-log4j binding.
- Other numerous libraries, using either commons loggings or log4j.
I am considering migrating our own code base to slf4j api, but I am not sure if the benefits are strong enough and worth the effort. Currently I am aware of the following benefits:
- Cleaner api.
- Performance improvements – namely the ability to use parameterized logging methods.
- Ability to switch easily to logback in the future (currently logback is out of the question).
- No need for additional jars, since I already have them.
Are there any other benefits? Are there any drawbacks that I am not aware of yet?
The only benefit I see for switching, is that you can funnel all the logging frameworks through only one framework, which might simplify your configuration.
Probably the main reasons why I moved to slf4j (this only applies to slf4j + logback) is that you can reload the configuration via JMX, which is GREAT when you have a problem that disappears with a server restart.