Re: [Log4j] Header/footer and thread context

2017-12-03 Thread Mikael Ståldal
This gets more and more confusing the more I dig into it. SmtpAppender apparently supports PatternLayout conversions in the subject (which is not documented), but then are done on the very first log event sent through the SmtpAppender (or actually the SmtpManager, which can be shared among mul

Re: [Log4j] Header/footer and thread context

2017-12-03 Thread Mikael Ståldal
It does work for the subject and body, see the new unit test SmtpAppenderAsyncTest i just pushed to Git master. And I think this behaviour make sense and should be retained. The question is about header/footer. I think that it doesn't make sense to use ThreadContext lookups there. But maybe we

Re: [Log4j] Header/footer and thread context

2017-11-30 Thread Remko Popma
Generally it doesn’t make sense to expect ThreadLocal lookups to work with async appender/loggers. Another lookup should be used. I haven’t looked at the code but I expect that the subject is cached somehow. Perhaps this should be changed (to no caching) so that the user experience is consiste

Re: [Log4j] Header/footer and thread context

2017-11-30 Thread Matt Sicker
I'm not sure if this use case makes much sense. Dynamic data like that makes more sense in the message itself, though I'm sure there are several ways to do this. On 30 November 2017 at 15:02, Mikael Ståldal wrote: > I am looking at https://issues.apache.org/jira/browse/LOG4J2-2007 > > What is th

[Log4j] Header/footer and thread context

2017-11-30 Thread Mikael Ståldal
I am looking at https://issues.apache.org/jira/browse/LOG4J2-2007 What is the expected behavior here? Should there be any thread context for header/footer? I guess it should be consistent for sync and async logging, which it isn't right now. But maybe the async case is correct in not includin