I am using JSF 2.0, Spring, Hibernate and I need to implement Log4J for centralized error catching. Can anybody help?
Asked
Active
Viewed 622 times
2 Answers
1
If you want centralized logging and since you are using Spring and Hibernate, things are a bit more complicated than just providing a log4j.properties because Hibernate uses SLF4J as logging facade while Spring uses Jakarta Commons Logging (JCL) as logging facade and they seem to conflict.
My recommendation would be to use SLF4J and for that, you'll need to:
- provide
slf4j-api.jar(you should actually get this one with Hibernate) - remove
commons-logging.jarthat comes from Spring - provide
jcl-over-slf4j.jarto bridge JCL calls to SLF4J - provide the SLF4J binding for Log4J (
slf4j-log4j12.jar) to bridge SLF4J calls to Log4J - provide
log4j.jar
See also
Community
- 1
- 1
Pascal Thivent
- 562,542
- 136
- 1,062
- 1,124
0
log4j has absolutely nothing to do with spring, jsf or hibernate.
- place
log4j.jarinWEB-INF/lib - get a sampel
log4j.propertiesand place in on the root of your classpath - use
private static final Logger log = Logger.getLogger(CurrentClass.class);
Bozho
- 588,226
- 146
- 1,060
- 1,140