You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by "Luedecke, Michael J" <mi...@eds.com> on 2007/04/10 21:29:02 UTC

AsyncAppender Issue

I'm losing logs when I use the AsyncAppender for some reason.  This loss
of logs occurs whether I'm using a custom appender or out-of-the-box
appender (i.e. FileAppender).  

I have not noticed this problem when I send a string in the log method
call.  It only seems to happen when I pass an object in the log method
call.  The object I'm sending in the log is not large or complex.  It is
a HashMap collection containing only 5 or 6 entries.  

The logs that get created successfully varies.  Sometimes I get all of
the logs I'm expecting, but, most of the time I don't.  If I use the
appenders without the AsyncAppender I'm consistently getting all of the
expected logs.  

I'm not creating a large number of logs (my test case only creates 3
logs).  Nevertheless, I have tried to change all of the options used by
the AsyncAppender just in case, but it has not resolved anything.  

Other characteristics of my environment:
* Using log4j 1.2.14
* Using JDK 1.4.2_14
* OS is Windows XP

Has anyone else experienced this type of behavior with the
AsyncAppender?

Thanks.



RE: AsyncAppender Issue

Posted by "Luedecke, Michael J" <mi...@eds.com>.
I believe I have determined the cause of the behavior I was experiencing
with the AsyncAppender.  It was a combination of things:

1.  I was "re-using" an instance-level object I was trying to log.  It
appears I was overwriting the properties of the object before the
AsyncAppender had a chance to pass the log onto the attached appender.
This was resolved by making sure I was sending a new local-level object
reference in each log method call.

2.  My application was stopping before the AsyncAppender had a chance to
log the last logs.  I now close the AsyncAppender before the application
closes, which forces the last logs to complete before the application
completely closes.

Thanks. 

-----Original Message-----
From: Curt Arnold [mailto:carnold@apache.org] 
Sent: Tuesday, April 10, 2007 3:58 PM
To: Log4J Users List
Subject: Re: AsyncAppender Issue


>
> Has anyone else experienced this type of behavior with the 
> AsyncAppender?
>
> Thanks.
>
>

Nope.  You should pack up your test case and file a bug report to see if
we can figure out what is going on.  If you can identify the problem and
propose a patch even better.

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


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


Re: AsyncAppender Issue

Posted by Curt Arnold <ca...@apache.org>.
>
> Has anyone else experienced this type of behavior with the
> AsyncAppender?
>
> Thanks.
>
>

Nope.  You should pack up your test case and file a bug report to see  
if we can figure out what is going on.  If you can identify the  
problem and propose a patch even better.

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


RE: AsyncAppender Issue

Posted by "Luedecke, Michael J" <mi...@eds.com>.
Here is the AsyncAppender configuration in my log4j.xml file:

<appender name="ASYNC" class="org.apache.log4j.AsyncAppender">
	<param name="BufferSize" value="128" />
      <param name="LocationInfo" value="true" />
      <param name="Blocking" value="true" />
	<appender-ref ref="Local" />
</appender> 

I've tried setting buffer to "false" and "true".  I'm only creating
three logs in my test case, so I was thinking this may not be a full
buffer problem.

Thanks.

-----Original Message-----
From: James Stauffer [mailto:stauffer.james@gmail.com] 
Sent: Tuesday, April 10, 2007 2:36 PM
To: Log4J Users List
Subject: Re: AsyncAppender Issue

How are you configuring AsyncAppender.  I think it has an option that
throws away logs when the buffer is full.

On 4/10/07, Luedecke, Michael J <mi...@eds.com> wrote:
> I'm losing logs when I use the AsyncAppender for some reason.  This 
> loss of logs occurs whether I'm using a custom appender or 
> out-of-the-box appender (i.e. FileAppender).
>
> I have not noticed this problem when I send a string in the log method

> call.  It only seems to happen when I pass an object in the log method

> call.  The object I'm sending in the log is not large or complex.  It 
> is a HashMap collection containing only 5 or 6 entries.
>
> The logs that get created successfully varies.  Sometimes I get all of

> the logs I'm expecting, but, most of the time I don't.  If I use the 
> appenders without the AsyncAppender I'm consistently getting all of 
> the expected logs.
>
> I'm not creating a large number of logs (my test case only creates 3 
> logs).  Nevertheless, I have tried to change all of the options used 
> by the AsyncAppender just in case, but it has not resolved anything.
>
> Other characteristics of my environment:
> * Using log4j 1.2.14
> * Using JDK 1.4.2_14
> * OS is Windows XP
>
> Has anyone else experienced this type of behavior with the 
> AsyncAppender?
>
> Thanks.
>
>
>


-- 
James Stauffer        http://www.geocities.com/stauffer_james/
Are you good? Take the test at http://www.livingwaters.com/good/

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


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


Re: AsyncAppender Issue

Posted by James Stauffer <st...@gmail.com>.
How are you configuring AsyncAppender.  I think it has an option that
throws away logs when the buffer is full.

On 4/10/07, Luedecke, Michael J <mi...@eds.com> wrote:
> I'm losing logs when I use the AsyncAppender for some reason.  This loss
> of logs occurs whether I'm using a custom appender or out-of-the-box
> appender (i.e. FileAppender).
>
> I have not noticed this problem when I send a string in the log method
> call.  It only seems to happen when I pass an object in the log method
> call.  The object I'm sending in the log is not large or complex.  It is
> a HashMap collection containing only 5 or 6 entries.
>
> The logs that get created successfully varies.  Sometimes I get all of
> the logs I'm expecting, but, most of the time I don't.  If I use the
> appenders without the AsyncAppender I'm consistently getting all of the
> expected logs.
>
> I'm not creating a large number of logs (my test case only creates 3
> logs).  Nevertheless, I have tried to change all of the options used by
> the AsyncAppender just in case, but it has not resolved anything.
>
> Other characteristics of my environment:
> * Using log4j 1.2.14
> * Using JDK 1.4.2_14
> * OS is Windows XP
>
> Has anyone else experienced this type of behavior with the
> AsyncAppender?
>
> Thanks.
>
>
>


-- 
James Stauffer        http://www.geocities.com/stauffer_james/
Are you good? Take the test at http://www.livingwaters.com/good/

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