質問

I set log4j to show the debug information.

then shows me in console:

DEBUG-"template/simple/head.ftl"["zh_CN",UTF-8,parsed] using cached since jar:file:/C:/Users

I know this information come from a jar file in my project, maybe from struts2

and I also attached the source code for this jar package

But I cannot search jar's source code for a "string match" in eclipse IDE.

So, How can I locate the code behind that shows this log4j message?

役に立ちましたか?

解決

Modify your log4j pattern to include the fully qualified class name in the log message by adding %C and method name with %M. Then CTRL+SHIFT+T and type the class name, and you should see the jar on the right of each matching class, as in the screenshot. If you also have the sources attached you can also open the class, otherwise you can install a decompiler like jad or java decompiler

enter image description here

他のヒント

log4j.appender.FILE.layout.ConversionPattern=[%d{MMM dd HH:mm:ss}] %-5p (%F:%L) - %m%n

set conversion pattern parameter value like "[%d{MMM dd HH:mm:ss}] %-5p (%F:%L) - %m%n" as stated in above line to print Date Time Class Name and Line number.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top