Saturday, July 30, 2011

log4j across many dependencies through slf4j

I ran into a stupid problem that made me feel silly. I had a project that depended on a few jars that I myself had made using log4j. Well classloader issues arise if you just add them to classpath and try to run. different loaders load log4j. Hence why it is important to use slf4j and it's binding for log4j. I just added these in the pom and it was all good (scope depends on your project). Also, log4j files go under /src/main/resources in maven....that way they get copied to WEB-INF/classes/



org.slf4j
slf4j-api
1.6.1
runtime


org.slf4j
slf4j-log4j12
1.6.1
runtime


log4j
log4j
1.2.16
runtime

No comments:

Post a Comment