开发者

Implement or replace commons logging

开发者 https://www.devze.com 2023-03-31 00:51 出处:网络
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.

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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号