You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by "Friedli Beat [UFA AG Her]" <Be...@ufa.ch> on 2001/08/20 13:22:01 UTC
How see the methode-name in the Logefile
Currently my log-file-entries look the following:
220 ERROR [TestRunner-Thread] datamodel.DataModelKunden - Adresse ist
null!
---------------
I'd like not only to see the class-name but also the methode-name. So that I
find out quicker where the problem is. The log-file-entries should look like
this:
220 ERROR [TestRunner-Thread] datamodel.DataModelKunden.getKundenName() -
Adresse ist null!
How can I do that?
Mit freundlichen GrĂ¼ssen
Beat Friedli
RE: How see the methode-name in the Logefile
Posted by Kenji Konaka <kk...@softalia.com>.
hi! - slightly related:
is it possible to identify each of the object instances
involved in the method invocation chain? that is, if
I've had a log code like this:
public class Abc {
static void x() {
log();
}
static class B {
void y() {
x();
}
}
static class A {
void z() {
new B().y();
}
}
static public void main(String[] args) {
new A().z();
}
static void log() {
// do the actual logging - ...but for now:
new Throwable().printStackTrace();
}
}
I may obtain something like this with the standard code:
java -classpath . Abc
java.lang.Throwable
at Abc.log(Abc.java:20)
at Abc.x(Abc.java:3)
at Abc$B.y(Abc.java:7)
at Abc$A.z(Abc.java:12)
at Abc.main(Abc.java:16)
what I would like to do _now_ is to obtain a (log)
output which may look like this:
java.lang.Throwable
at Abc.log(Abc.java:20)
at Abc.x(Abc.java:3)
at Abc$B.y(Abc.java:7) -- Abc$B@4b222f
at Abc$A.z(Abc.java:12) -- Abc$A@2f6684
at Abc.main(Abc.java:16)
(sorry - that this sounds an awful lot like a FAQ...)
regards,
kenji
> From: "Timothy Mulle'" <tm...@iname.com>
> Date: Mon, 20 Aug 2001 08:09:50 -0400
>
> Freidii,
>
> use the %M character in your patternlayout...take a look at the
> PatternLayout javadocs for the complete list.
>
> - Tim
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org
RE: How see the methode-name in the Logefile
Posted by Timothy Mulle' <tm...@iname.com>.
Freidii,
use the %M character in your patternlayout...take a look at the
PatternLayout javadocs for the complete list.
- Tim
-----Original Message-----
From: Friedli Beat [UFA AG Her] [mailto:Beat.Friedli@ufa.ch]
Sent: Monday, August 20, 2001 7:22 AM
To: 'LOG4J Users Mailing List'
Subject: How see the methode-name in the Logefile
Currently my log-file-entries look the following:
220 ERROR [TestRunner-Thread] datamodel.DataModelKunden - Adresse ist
null!
---------------
I'd like not only to see the class-name but also the methode-name. So that
I find out quicker where the problem is. The log-file-entries should look
like this:
220 ERROR [TestRunner-Thread]
datamodel.DataModelKunden.getKundenName() - Adresse ist null!
How can I do that?
Mit freundlichen GrĂ¼ssen
Beat Friedli