This is where the NDC would be useful. In Class 2:
NDC.push("Class 2"); In Class 1: NDC.push("Class 1"); Then when you are ready to log a message: log.debug("Message"); The NDC entries will be available via the LoggingEvent that is send to the appender, so if you configure an appender to actually output the contents of the NDC, you'll be able to see it. (see things like PatternLayout on how to explicitly request NDC to be output in the appender). NDC acts as a Stack for each Thread of execution, so it retains the order of push/pop. Don't forget to NDC.pop() at the end of each method where you NDC.push(...).. cheers, Paul Smith On Thu, 2003-10-02 at 01:10, David Liles wrote: > I just started using log4j and am having trouble trying to figure out how to chain > logging messages.... > > class 1 makes a call to class 2.... I would like to be able to pass the message from > class 2 to class 1 where it would ultimately be logged, that way when I review the > log file it would show that the message originated in class 2, but would be > displayed something like this: > > class2 -> class1 - message..... > > Hope I'm making sense.... > > Thanks - Dave --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]