Thanks for the replies.
I achieved it by a Filter that puts the modified value in MDC
thanks all
On Tue, Apr 8, 2008 at 8:15 PM, Matthew Kemp <[EMAIL PROTECTED]> wrote:
> You could create your own Layout class. While you loose some of the
> flexibility of the PatternLayout class you can perform any message
> formatting/encoding. The Layout class takes a LogEvent and returns the
> formatted string. It might also be possible to extend the PatternLayout.
>
> Matt
>
>
>
>
>
> On Tue, Apr 8, 2008 at 12:57 PM, jm <[EMAIL PROTECTED]> wrote:
>
> > Hi,
> >
> > I need some functionality I don't know how to implement:
> > Right now my big codebase is full of logger.info("a message"); stuff.
> > I have a new requirement to format log files in a specific way, for
> > instance:
> > 20080408-18:57:24|ProcessA.java|23|hostname|this is where the message goes
> > As you can see, fields are separated by |, and I have been able to do
> > all required by setting some stuff as MDC and by using existing values
> > from PatternLayout. The only remaining thing is that in case the %m
> > contains a pipe, it must be escaped to \|.
> >
> > I wish I could do that in a centralized way (maybe even subclassing
> > some log4j class) instead of changing all the calls to logger.info()
> > to LogUtil.log() and escaping the pipe in the new static method.
> >
> > is that feasible?
> >
> > many thanks
> > javi
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]