Great,<br>This looks like it would work for me. The only question I have is what&#39;s the &quot;UnsynchronizedAppenderBase&quot; <br>and where can I find some info about it. <br>Thanks<br>Greg.<br>  <br><br><div class="gmail_quote">
On Mon, May 11, 2009 at 10:48 PM, Ralph Goers <span dir="ltr">&lt;<a href="mailto:rgoers@apache.org">rgoers@apache.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
You could create your own Appender that extends UnsynchronizedAppenderBase. In the Appender write the events to a Queue, taking care that the Queue is thread-safe (for example, by using one of the Queues in java.util.concurrent). You could then have a separate thread that then does the real work of removing the logging events from the queue and processing them. With this, the only locking that would occur in the application thread would be in adding the LoggingEvent to the queue. However, it would also have to retrieve the caller data and the thread name prior to adding the LoggingEvent to the queue.<br>

<br>
Actually, now that I think about it, this seems like it would be a great AsynchronousAppender class. It would just need to be configured with the Appender that writes the data.<br>
<br>
Ralph<div><div></div><div class="h5"><br>
<br>
On May 11, 2009, at 4:54 PM, Greg Flex wrote:<br>
<br>
</div></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div><div class="h5">
Hi Ceki,<br>
I (again) have some questions about log4j.<br>
(I guess Logback works the same way....)<br>
I was wondering if there&#39;s a way to save a &quot;logger object&quot; to a<br>
data structure like a queue or something before sending it to some appender.<br>
For example:<br>
The socket appender will cause the log4j client to lock/freeze if there&#39;s no link to the server.<br>
I verified it and it does lock the client.<br>
I need to deal with this issue so I&#39;d like to store &quot;logger objects&quot; (or something)<br>
before they go to the socket or some other appender first.<br>
At the moment I have a wrapper around the log4j that when the debug method is called<br>
I&#39;m just calling the log4j debug method passing some args etc.<br>
so I have:   logger.debug(&quot;some stuff&quot;);<br>
The configuration file does the trick and outputs to the console (at the moment) all the info:<br>
the class name, the method name, the line number etc.<br>
I&#39;d like to save this info somehow to some object that I can store in a queue or something.<br>
How do I retrieve this information programmatically? Is there a way?<br>
I know about LoggingEvent object, could I use it and pass the above stated information<br>
to its constructor then store it in a queue?<br>
Logger gets me for free (like method name etc.)<br>
Any suggestion?<br>
Thanks a lot.<br>
Greg.<br>
<br>
<br></div></div>
_______________________________________________<br>
Logback-user mailing list<br>
Logback-user@qos.ch<br>
<a href="http://qos.ch/mailman/listinfo/logback-user" target="_blank">http://qos.ch/mailman/listinfo/logback-user</a><br>
</blockquote>
<br>
_______________________________________________<br>
Logback-user mailing list<br>
Logback-user@qos.ch<br>
<a href="http://qos.ch/mailman/listinfo/logback-user" target="_blank">http://qos.ch/mailman/listinfo/logback-user</a><br>
</blockquote></div><br>