logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "gautam" <gau...@applabs.net>
Subject RE: org.apache.log4j.net.SocketAppender - Help with setLocationIn fo
Date Wed, 13 Nov 2002 08:12:16 GMT
The JavaC documentation for both 1.3.1 & 1.4 have the following :

-g Generate all debugging information, including local variables. By
default, only line number and source file information is generated. <== !!!!

-g:none Do not generate any debugging information.

-g:{keyword list} Generate only some kinds of debugging information,
specified by a comma separated list of keywords. Valid keywords are:
	source Source file debugging information
	lines Line number debugging information
	vars Local variable debugging information

(http://java.sun.com/j2se/1.3/docs/tooldocs/win32/javac.html &
http://java.sun.com/j2se/1.4.1/docs/tooldocs/solaris/javac.html)

So, if you use "javac test.java", you get the line number and source file
info in the class files (default behavior). As a result, Log4J is able to
give you the Location Info. This behaviour is not dependent on JDK version
(1.3.1/1.4). However, if you use the "-g" option, then the location info is
dependent on the -g option (-g:none or something else). This will happen
with both 1.3.1 & 1.4.

Regards,

Gautam Satpathy

-----Original Message-----
From: Nicholas Orr [mailto:Nicholas.Orr@mim.com.au]
Sent: Wednesday, November 13, 2002 12:02 PM
To: 'Log4J Users List'
Subject: RE: org.apache.log4j.net.SocketAppender - Help with
setLocationIn fo


You sure 1.4 is *dependent* on the "-g" command.
I just did a test then, and used "javac test.java" to compile and "java
test" to run and I got location info in Chainsaw.

So...How do you explain that??

-----Original Message-----
From: gautam [mailto:gautam@applabs.net]
Sent: Wednesday, 13 November 2002 3:40 PM
To: Log4J Users List
Subject: RE: org.apache.log4j.net.SocketAppender - Help with setLocationIn
fo


Hello Folks,

I ran a few tests with Log4J 1.2.6. Used JDK 1.3.1_04 & 1.4. In both cases,
the location info is *dependent* on the "-g" command used to compile my Java
source. Also, you *must* have the "log4j.appender.<Appender
Name>.LocationInfo=true" flag set in order to see the location info.

In order to get location info, use the "-g:source,lines,vars" flag with
JavaC and set the "...LocationInfo=true" flag for your appenders in Log4J
properties. This is independent of the JDK version.

I have tested this with logging to LF5 & ChainSaw, using the SocketAppender
in both cases.

Please note that calculating the LocationInfo is very expensive and is not
recommended for production enviornments.

Regards,

Gautam Satpathy

-----Original Message-----
From: Ceki Gulcu [mailto:ceki@qos.ch]
Sent: Friday, November 08, 2002 1:50 PM
To: Log4J Users List
Subject: RE: org.apache.log4j.net.SocketAppender - Help with setLocationIn
fo



log4j location info behavior does NOT depend on the JDK, at least not on 1.3
or 1.4.

At 11:47 08.11.2002 +1000, you wrote:
>Figured this one out,
>
>I'm using Jdev9i 9.0.3
>It lets you choose which version of java to use, in the projects where
>location is not working they are using 1.3 In the projects where it
>does work it is using 1.4
>
>Nicholas Orr
>
>-----Original Message-----
>From: Nicholas Orr [mailto:Nicholas.Orr@mim.com.au]
>Sent: Friday, 8 November 2002 11:19 AM
>To: Log4j Mailing List
>Subject: org.apache.log4j.net.SocketAppender - Help with
>setLocationInfo
>
>
>Hi,
>
>I have just started to use Log4j and am having an inconsistency
>problem.
>
>My log4j.properties file looks like this
>
>log4j.appender.CHAINSAW_CLIENT=org.apache.log4j.net.SocketAppender
>log4j.appender.CHAINSAW_CLIENT.LocationInfo=true
>log4j.appender.CHAINSAW_CLIENT.Port=4445
>log4j.appender.CHAINSAW_CLIENT.RemoteHost=localhost
>log4j.rootLogger=DEBUG, CHAINSAW_CLIENT
>
>I use this for debugging.  In one project I get location info but in
another
>one I don't get location info. What is going on??
>
>Here is the code I'm using in both
>
><--- start code --->
>
>package com.move.cool;
>
>import org.apache.log4j.*;
>
>public class LogMe  {
>   private static Logger log = Logger.getLogger(LogMe.class.getName());
>
>   public LogMe() {
>
>     log.info("--Hello1");
>     log.info("--Hello3");
>     log.error("--Hello5");
>     log.warn("--Hello6");
>     log.error("MAJOR PROBLEM");
>     System.out.println("End");
>   }
>
>
>   public static void main(String[] args) {
>     System.out.println("Begin");
>     LogMe logMe = new LogMe();
>     System.out.println("End");
>   }
>}
>
><--- end code --->
>
>
>
>**********************************************************************
>The information contained in this e-mail is confidential and is
>intended only for the use of the addressee(s). If you receive this
>e-mail in error, any use, distribution or copying of this e-mail is not
>permitted. You are requested to forward unwanted e-mail and address any
>problems to the MIM Holdings Limited Support Centre.
>
>For general enquires:   ++61 7 3833 8000
>Support Centre e-mail:  supportcentre@mim.com.au
>Support Centre phone:   Australia 1800500646
>                                         International ++61 7 38338042
>**********************************************************************
>
>
>--
>To unsubscribe, e-mail:
<mailto:log4j-user-unsubscribe@jakarta.apache.org>
>For additional commands, e-mail:
<mailto:log4j-user-help@jakarta.apache.org>

--
Ceki

TCP implementations will follow a general principle of robustness: be
conservative in what you do, be liberal in what you accept from others. --
Jon Postel, RFC 793



--
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>

--
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