That actually is an interesting concept.  I can picture registering a
ThreadDumpMessage along with a Filter and when the Filter matches the
Message gets logged. The only problem with that is I'm not sure I'd want to
include that in the logging system itself since it could only be evaluated
as log messages flow through.

Ralph


On Tue, Sep 20, 2011 at 9:37 AM, John Vasileff <john.li...@gmail.com> wrote:

>
> On Sep 20, 2011, at 2:36 AM, Ralph Goers wrote:
>
> >
> > On Sep 19, 2011, at 6:39 PM, John Vasileff wrote:
> >
> >>
> >> package org.apache.logging.log4j.message;
> >>
> >> /**
> >> * A Message that supports lazy initialization.
> >> */
> >> public interface InitializingMessage extends Message {
> >>
> >> /**
> >>  * Lazily perform expensive initialization tasks that would otherwise
> occur in
> >>  * the constructor. For example, cloning mutable message content or
> gathering
> >>  * data to be logged. Loggers are required to call this method
> immediately
> >>  * after determining this Message is likely to be logged based on the
> log
> >>  * Level and Marker, and before returning from the log method (i.e.
> >>  * trace(message)). The Logger will not call initialize() if no logging
> will be
> >>  * performed based on Level and Marker.
> >>  *
> >>  * Initialization must be performed before returning from the first call
> to this
> >>  * method. Subsequent calls must be no-ops.
> >>  *
> >>  * @return This Message.
> >>  */
> >> Message initialize();
> >>
> >> }
> >
> > How would you feel about calling it DeferredMessage?
> >
> > Ralph
>
> I think that would work.
>
> The one problem I see is that it could imply that Message delivery is
> deferred.  That is, the Message would be held by the logging system until
> logging is triggered by some future event.  DeferredInitializationMessage
> would be more clear, but is rather verbose.
>
>
> John
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org
> For additional commands, e-mail: log4j-dev-h...@logging.apache.org
>
>

Reply via email to