log4j logging twice

前端 未结 9 1633
眼角桃花
眼角桃花 2021-02-04 23:02

I am using log4j to log error and other system information. but come of the info logged twice at INFO level.

public static void main(final String... args) throws         


        
9条回答
  •  梦如初夏
    2021-02-04 23:57

    If you can run the program with a Java debugger, put a breakpoint in the program where one of these double logging calls happen.

    Examine the logger object in the debugger. If it is an org.apache.log4j.Logger (v 1.2.x) then it may have an AppenderAttachableImpl. You can query the AppenderAttachableImpl for the appender list.

    If you find more than 1 appender, this could be the problem - and a clue to fixing it.

提交回复
热议问题