Yes, log4j2.xml also defines a AsyncAppender but which is not mapped to any
logger. Is there a way that I can get the asyncAppender from the
xmlConfiguration and hook my RollingFileAppender? I did not find any such
convenience.

Why is handling of Appenders in log4j2 not straightforward? Or probably If
i am not aware can you please help me.

Regarding Lakh, I meant , 5Lakh lines inside my log file, which I am
printing in a for loop for my testing.:-)

-Sudharma


On Fri, Jul 19, 2013 at 4:03 AM, Remko Popma <[email protected]> wrote:

> Does your log4j2.xml also define an AsyncAppender?
>
> (Btw, what is a lakh?)
>
> Sent from my iPhone
>
> On 2013/07/19, at 0:31, Sudharma Puranik <[email protected]>
> wrote:
>
> > I have a log4j2.xml configuration file from which I am getting the
> Logger, attached is the snapshot. when my logger is created a new thread is
> created.
> >
> > Programmatically,I create a RollingFileAppender and attach the same to
> AsyncAppender . I attach the Async Appender to the configuration of the
> log4j.xml, And when I start the Async Appender again a new thread is
> created.
> >
> > The problem now is that both the threads are writing to my async
> appender so for a 5 lakh line log, I get 10 lakh lines because each thread
> is writing the log.
> >
> > Is this a bug? because I get a logger a new thread is generated and when
> I create a async appender another thread is created and both are doing the
> same job.
> >
> > -Sudharma
> > <asyncAppendThread.png>
> > <loggerThread.png>
> >
> > ---------------------------------------------------------------------
> > 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]
>
>

Reply via email to