- discarded dependencies: commons-logging (1.0.4) and log4j (1.2.8)
- added new dependencies: slf4j-api (1.4.3), logback-core (0.9.8) and logback-classic (0.9.8)
- added one more dependency: jcl104-over-slf4j (1.4.3)
- created a logging configuration file logback.xml in the root of classpath (replacement for log4j.properties)
Of course, I had to modify java code so that it uses Logger instead of Log now.
As for the item #3 it deserves a little bit more clarification. Since my final war is going to be deployed in Tomcat bundled with several other jar libraries (mostly apache commons, Spring and great Stripes framework) then dependency on JCL still resists. The solution to this problem is jcl104-over-slf4j.jar which implements the public API of JCL but using SLF4J underneath [see slf4j manual].
4 comments:
What is the reason that I wanna swith from LOG4J to SLF4J, any advantages or so?
If you use NetBeans platform then Jackpot module can do all the refactoring for you (just write two simple rules according tutorial) and change in the project is piece of cake ;-)
3rojka, regarding your question about the reason I recommend you to look at the SLF4J web pages and dig for yourself. For short I can recommend two points from FAQ section:
http://www.slf4j.org/faq.html#yet_another_facade and http://www.slf4j.org/faq.html#why_new_project By far these are not the only reasons...
Anyway, what is the reason for not switching if it is so easy?
You don't really need to modify your existing code, you may simpli use log4j-over-slf4j module, as described at http://www.slf4j.org/log4j-over-slf4j.html
Post a Comment