logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "gautam" <gau...@applabs.net>
Subject RE: Interesting Problem
Date Wed, 30 Oct 2002 08:18:32 GMT
Hello Thomas,

Log4J uses the debug information in Java class files to generate the
"Location" information. In order to see this info, your source has to be
compiled with the "-g:...." option of "javac".

Please try compiling with "javac -g ....." or "javac -g:lines,vars,source
.....".

For example,
javac -verbose -classpath
./libs/log4j-1.2.6.jar;./libs/junit.jar;./libs/servlet.jar; -d
./build/ -g:lines,vars,source @sourcefiles.txt

Check the javac documentation at
http://java.sun.com/j2se/1.3/docs/tooldocs/win32/javac.html#options

I have tested the above using a plain Java class and a servlet (LF5Test in
the logs below) running under Tomcat 4.0.5/JDK 1.3.1_04. Without debug
information I get :

[slf5s.start]30 Oct 2002 13:41:59,953[slf5s.DATE]
DEBUG[slf5s.PRIORITY]
[slf5s.NDC]
HttpProcessor[8080][1][slf5s.THREAD]
LF5Test[slf5s.CATEGORY]
LF5Test.init(Unknown Source)[slf5s.LOCATION]
Hello, my name is Homer Simpson.[slf5s.MESSAGE]

With debug information I get :

[slf5s.start]30 Oct 2002 13:32:13,687[slf5s.DATE]
DEBUG[slf5s.PRIORITY]
[slf5s.NDC]
HttpProcessor[80][4][slf5s.THREAD]
LF5Test[slf5s.CATEGORY]
LF5Test.init(LF5Test.java:42)[slf5s.LOCATION]
Hello, my name is Homer Simpson.[slf5s.MESSAGE]

Hope this helps.

Regards

Gautam Satpathy

-----Original Message-----
From: Thomas Saxtoft [mailto:t.saxtoft@sondagsavisen.dk]
Sent: Tuesday, October 29, 2002 7:39 PM
To: log4j-user@jakarta.apache.org
Subject: Re: Interesting Problem


Gautam, please read my posting here
http://groups.yahoo.com/group/Log4J/message/2852
As you can see I get the location information on the client but not on the
server. I have made a typo in that posting. Where I do get location
information is on the client side.

What would I write directly in the command line, when not using Ant? I'm
referring to the debug stuff in your post.

Thomas

--- In Log4J@y..., "gautam" <gautam@a...> wrote:
> Hello,
>
> Log4J does not output the classname and line number when using the "%F:%L"
> pattern if the class files do not have debug information. In ANT 1.5
(which
> I am using), the "debug" attribute of the javac task has to be set to
"on".
> Also the "debuglevel" attribute should be set to "lines" ("lines, vars,
and
> source"). The "debug" attribute defaults to "off" and hence the
"debuglevel"
> attribute is ignored. With debug="on" debuglevel="lines", the javac -g
> option used is "-g:lines". Using the ANT 1.5 defaults, you end up the
> "-g:none". Result; No debug info in class files and ?:? in Log4J logs.
>
> My javac target has the following:
>
> <javac srcdir="${java.source.dir}" destdir="${build.dir}" debug="on"
> debuglevel="lines">
> 	<classpath refid="compile.classpath"/>
> </javac>
>
> With these two attributes in my build file, Log4J is able to find the
> required debug information and displays output like the following :
>
> INFO [main] [model.AbstractDataListHandler] {3875}
> (AbstractDataListHandler.java:263) - Leased the DataListHandler. Lease
> Counter = 1
>
> I suspect the defaults for these two attributes were different in earlier
> ANT versions. I have to check the source to make sure.
>
> Hope this helps.
>
> Regards,
>
> Gautam Satpathy



--
To unsubscribe, e-mail:   <mailto:log4j-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:log4j-user-help@jakarta.apache.org>




--
To unsubscribe, e-mail:   <mailto:log4j-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:log4j-user-help@jakarta.apache.org>


Mime
View raw message