开发者

LOG4J call only for specific function

asking this as an experiences Log4j user:

We have a pretty big class with lots of debug statements (Logger.getLogger(class).debug("Borrowed connection "+con.getId())... you know what I mean :)

Now 开发者_运维知识库I suspect one specific function to not work as expected and I want only this one particular function to log the debug output, the rest of the Class should keep the "error" level.

is there a solution to this? Google wouldn't satisfy my this time :)


You could use an own loger per method even though that may be a little inconvenient.

Logger.getLogger(class.getName()+"#methodName").debug(..)

will allow to define the log lever per method.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜