logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "lvxiaoyi" <lvxia...@aspire-tech.com>
Subject 答复: One question about extending log4j
Date Thu, 10 Aug 2006 04:50:00 GMT
> > Hi all,
> >
> > I encountered a problem in my requirement.
> >
> > Several threads will write different type Value Object to an Object
> > and one Log thread will consume these VO in the Queue, and the Log
> is
> > extended from log4J, it will write the VO's value to different log files
> > according to the VO's type.
> >
> > So, what should I do? Could anybody give me a solution?
> For each VO, log to a different logger, named after the type of the
> VO. For example:
> // receive VO
> ValueObject vo = getFromQueue();
> Logger log = Logger.getLogger(vo.getType());
> log.log(whatever you wish to log);
> And then, in the log4j configuration file, create an different
> appender for each VO Type. Attach those appenders to the loggers named
> after the VO Types.
> --
> Javier González Nicolini

Hi, Javier

Thank you very much. My problem is that I have hundreds types, and the line
of the log file should be populated from the values of the vo fields.

So, I want to implement a custom Appender and a Layout, and the Appender
could dynamically switch to different log file according to the vo type.

So, could you give me some suggestions? 


Joey Lv

To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org

View raw message