Franz Kafka
Franz Kafka

Reputation: 10851

Implement or replace commons logging

I use Spring which somehow relies on org.apache.commons.logging. I have got my own logger that already implements SLF4J and some proprietary protocol. So I'm really keen to use my logger.

In SLF4J you implement org.slf4j.impl.StaticLoggerBinder and use some factory and logger interface.

Is it the same in commons logging? Implement org.apache.commons.logging.LogFactory and use a few interfaces? Is there some reference implementation of LogFactory? Or am I thinking completely wrong here? All these different logging "standards" are driving me crazy.

Thanks

Upvotes: 0

Views: 1735

Answers (1)

Marsellus Wallace
Marsellus Wallace

Reputation: 18611

It should be quite easy to shut off commonslogging in Spring and integrate it with slf4j instead. At that point you can simply pass your own logger to Spring and use it through slf4j functions. You can find the information you need at paragraph 1.3.2 here.

Also, I'm not a fan of reinventing the wheel and I would strongly suggest you to look at existing or brand new logging frameworks like LogBack for instance.

Upvotes: 3

Related Questions