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 "Bhangale, Bhushan" <Bh...@g-trade.com> on 2002/08/15 00:30:00 UTC

How Log4j must be working?

Hi All,
 
I am wondering how log4j is built?
 
I understand that it works on a event driven model. I guess this event
driven model is based on Queue data structure where from one side all the
events are getting stored by the function which we call like log.info(),
log.error() etc. The log4j thread must be running continuously on the Queue
to read the event from other end and do something.
 
Am I right? What is the best java collection class to use as a Queue?
 
Thanks & Regards 
Bhushan Bhangale 
Sr. Software Engineer 
Fusion Infotech India Private Ltd. 
Ph. no. - 1-212-641-6932 (O) 
 


"The information in this e-mail, and any attachment therein, is 
confidential and for use by the addressee only. If you are not the 
intended recipient, please return the e-mail to the sender and delete 
it from your computer. Although The Bank of New York attempts to 
sweep e-mail and attachments for viruses, it does not guarantee that 
either are virus-free and accepts no liability for any damage sustained 
as a result of viruses." 


RE: How Log4j must be working?

Posted by Thomas Muller <tt...@online.no>.
 | I am wondering how log4j is built?

If you want to know more about the internals of Log4j I suggest you read
available documentation and the sourcecode.

 | I understand that it works on a event driven model. I guess this event
 | driven model is based on Queue data structure where from one side all the
 | events are getting stored by the function which we call like log.info(),
 | log.error() etc. The log4j thread must be running continuously
 | on the Queue
 | to read the event from other end and do something.

Note that the only appender logging in a separate thread is the
org.apache.log4j.AsyncAppender, it uses a log4j specific FIFO-queue
(org.apache.log4j.helpers.BoundedFIFO) to store the events.

 | Am I right? What is the best java collection class to use as a Queue?

This is off-topic, but a queue-like structure is easily backed up by a
suitable java.util.List implementation. You find some excellent threadsafe
structures in Doug Lea's concurrent library, see
http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/intro.h
tml.

Also, you might want to take a look at Jakarta Commons, see
http://jakarta.apache.org/commons/index.html.

Hope this helps.

--

Thomas




*************************************************************************
Copyright ERA Technology Ltd. 2002. (www.era.co.uk). All rights reserved. 
The information supplied in this email should be treated in confidence.
No liability whatsoever is accepted for any loss or damage 
suffered as a result of accessing this message or any attachments.

________________________________________________________________________
This email has been scanned for all viruses by the MessageLabs SkyScan
service. For more information on a proactive anti-virus service working
around the clock, around the globe, visit http://www.messagelabs.com
________________________________________________________________________

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>