On Jun 3, 2008, at 6:45 AM, Duseja, Sushil wrote:

Hello,

I used event.getLocationInformation().getMethodName() to log the method name (where event is the LoggingEvent object), but it does not appear to
be correctly logging the method name; it's fetching - '?' instead. Can
anyone please point me to the correct way of doing the same?

It seems as if the LocationInfo object is null. Do I need to set this
object?

Any help is appreciated.

Thanks.


Your application could have been compiled without debugging information which would result in that behavior.

Also, since construction of a Throwable to collect the stack trace is expensive and often not used, it is only constructed on request. Since it has to be constructed while on the same thread as the original call, the AsyncAppender has a parameter to determine whether that info should be collected before the event is placed in a queue to be processed by a worker thread. If you are using an AsyncAppender, set locationInfo to true.

Also, the current code was written before the addition of Throwable.getStackTrace() and attempts to capture and parse the output of printStackTrace which is by nature a bit fragile. There have been a couple of bugs fixed related to that, particularly involving the JRockit VM or class where the class name also appears in the namespace (org.example.FooBar.Foo).

If you believe that you are running into this, please tell the list what JVM and version of log4j that you are using. If you could step through the LocationInformation constructor and report your observations would be helpful.


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

Reply via email to