Java Logging: show the source line number of the caller (not the logging helper method)

前端 未结 8 1368
太阳男子
太阳男子 2020-12-08 03:50

The numerous (sigh...) logging frameworks for Java all do a nice job of showing the line number of the source file name for the method that created the log message:

8条回答
  •  一个人的身影
    2020-12-08 04:43

    This isn't possible out of the box. The best you can do in this case is to create the logger in the caller and pass it to the util method. This way, you can at least get an idea where the call has come from.

提交回复
热议问题