开发者

Log4j does not show line logging when use via .jar file

I have a program that uses a jar file which uses log4j. It's log4j property contains this pattern:

[%-5p] (%d) %l : %m%n

and when my program accesses a method inside the jar that executes a log, it produces this:

[INFO ] (2011-02-25开发者_JAVA百科 14:13:43,426) org.fractor.service.AppConfigService.getStringValueOf(?:?) : processing.user: root

I tried to include the original src folder of the jar file and when I ran the program again it outputs this:

[INFO ] (2011-02-25 14:13:43,426) org.fractor.service.AppConfigService.getStringValueOf(AppConfigService.java:125) : processing.user: root

This seems ok but when creating a jar file of the program which contains the jar that uses log4j, it doesn't include the jar's src folder and therefore gives out error.

Is it because it's just referencing the jar's src folder? Do I need to include the jar's src folder in the jar? Seems like using the jar would be useless at this point.

Is there another way for this? Thanks.


It sounds like the jar file contains classes which has been compiled without debug information.

As you've found this is highly desirable. I would suggest filing a bug with those responsible for building the jar, and then rebuild it yourself if you can. If not, then include the src folder, but the correct jar is better.


You need to compile the Java classes with debug enabled. In ant this would look as follows:

<javac destdir="XXXX" source="1.5" target="1.5" debug="true" encoding="UTF-8">

Using javac directly you need to specify the -g. See javac docs.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜