Ronald,

Since you are familiar with the relevant log4j code, do you know the stack trace lines look like?

At 07:26 PM 11/14/2003 +0100, Ronald Blaschke wrote:
Hi,

I managed to get aspectj 1.1.1 to generate log4j 1.2.8 traces when methods get
called or they return.  Unfortunately, for some code (eg for 'before'
pointcuts) only the file name is available, thus looking like this:
...
  at foo.bar(Foo.java)
...

Generating location information like
[?: ?]

If file-only is 'legal' in Java I don't know, but looking at Java 1.4
java.lang.StackTraceElement it may well be
(http://java.sun.com/j2se/1.4.2/docs/api/java/lang/StackTraceElement.html#getLineNumber()):

public int getLineNumber()
    ....
    Returns:
        the line number of the source line containing the execution
        point represented by this stack trace element, or a
        negative number if this information is unavailable.

Unfortunately, in log4j 1.2.8 LocationInfo#getFileName is not prepared for this,
as it always looks for ':'


int iend = fullInfo.lastIndexOf(':');
if(iend == -1)
   fileName = NA;
else {
   int ibegin = fullInfo.lastIndexOf('(', iend - 1);
   fileName = this.fullInfo.substring(ibegin + 1, iend);
}

I would like to see this changed to something more relaxed, to get
location information like [Foo.java: ?]

Any thoughts on that?

Best regards,
Ron
--

-- Ceki Gülcü

     For log4j documentation consider "The complete log4j manual"
     ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp

     import org.apache.Facetime;
     ApacheCon US 2003, 18-21 November http://apachecon.com/



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to