Return-Path: Delivered-To: apmail-logging-log4j-dev-archive@www.apache.org Received: (qmail 79872 invoked from network); 5 May 2004 18:52:32 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 5 May 2004 18:52:32 -0000 Received: (qmail 62549 invoked by uid 500); 5 May 2004 18:52:22 -0000 Delivered-To: apmail-logging-log4j-dev-archive@logging.apache.org Received: (qmail 62338 invoked by uid 500); 5 May 2004 18:52:21 -0000 Mailing-List: contact log4j-dev-help@logging.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Log4J Developers List" Reply-To: "Log4J Developers List" Delivered-To: mailing list log4j-dev@logging.apache.org Received: (qmail 62322 invoked from network); 5 May 2004 18:52:21 -0000 Received: from unknown (HELO argon.opsxchange.com) (208.36.121.146) by daedalus.apache.org with SMTP; 5 May 2004 18:52:21 -0000 content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: RE: New feature request: Add "Flush on Level" capability to FileAppender X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 Date: Wed, 5 May 2004 11:52:19 -0700 Message-ID: <76EA42AA0CC0FD4A899F16334EA46D31E37813@argon.opsxchange.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: New feature request: Add "Flush on Level" capability to FileAppender Thread-Index: AcQyUK8etEcoFGXDQnCcRXQYJTr8KAAgJbeA From: "Alan Brown" To: "Log4J Developers List" X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N It sounds like a nice feature to me. As an RFE to the RFE, I'd like to see an option to cap the amount of data in the buffer. My use case being that when I come across an ERROR or WARN statement, I'm only interested in the logging messages that led up to it. =20 A circular buffer to hold the cached logs would prevent me worrying about memory being sucked up by my logging system (a relevant concern if many appenders are being used. alan -----Original Message----- From: Simon Dorrat [mailto:simon.dorrat@gsjbw.com]=20 Sent: Tuesday, May 04, 2004 8:26 PM To: 'Log4J Developers List' Subject: New feature request: Add "Flush on Level" capability to FileAppender I submitted a feature request to Bugzilla last week and have not heard anything. I guess thats because you're all pretty busy. Has anyone had a chance to think about it? As I said I'm happy to do the work. Simon =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D http://issues.apache.org/bugzilla/show_bug.cgi?id=3D28647 Add "Flush on Level" capability to FileAppender Summary: Add "Flush on Level" capability to FileAppender Product: Log4j Version: 1.2 Platform: All OS/Version: All Status: NEW Severity: Enhancement Priority: Other Component: Appender AssignedTo: log4j-dev@jakarta.apache.org ReportedBy: sdorrat@jbwere.com.au New Feature Requested: I have used logging extensively for many years and tend to have my programs=20 log alot of information. When writing to a file this can cause a performance=20 impact due to very frequent disk I/O. So my own logging libraries I used (in=20 C, VB, PL/SQL) always had the ability to configure the level that the log text=20 was flushed to disk. =20 I have now extended FileAppender to create this feature. It simply allows you=20 to set the level that flushing occurs. Whenever a log event is logged for=20 that level or higher, a flush occurs. i.e. if the FlushLevel is INFO, then=20 when an INFO, WARN, ERROR or FATAL event is logged the stream will be flushed=20 to disk. DEBUG messages will accumulate and not flush until the next INFO=20 event is logged. Justification: =20 -The performance improvement allows for more detailed logging levels to be=20 left permanently on, or to have less impact when they are on.=20 - The logging style in most programs (certainly all mine) finish each major=20 processing step logging an event at a level higher than (or at least equal to)=20 the previously logged events. Eg an operation "createOrder" may have a number=20 of INFO and DEBUG msgs (and soon TRACE!) but would finish on a INFO msg=20 like "Successfully created order for 1000 ORCL...". This pattern guarantees that flush of all log event has occurred when the operation finishes, rather than waiting for some arbitrary point like a 8K buffer being filled. -The one downside is that if a program crashes, then any final logged events below the threshold that occurred after the last threhold level will not appear in the file. This is normally a small price to pay, as you just then lower the flush level and rerun so you get all events flushed. (This assumes=20 the error is repeatable, but with no flushing feature, the lower level events=20 wouldnt have been turned on due to the performance hit so you are no worse off=20 even if it is not). NOTE: I have implemented a shutdown hook to address the last issue - i.e.=20 automatically flush on VM exit, but that is a Java 1.3 method so cannot be=20 used in Log4j as I understand it. Current Status: I have written a new appender "LevelFlushedFileAppender" that extends=20 FileAppender that does this job. This works fine and I am happy to submit=20 it. However I think that it would be better to alter the FileAppender itself=20 and add the code directly to this, so it could be inherited in all classes=20 extending FileAppender. I am happy to implement it like this also. Let me know if the feature is accepted or you want further information, and=20 what I should do going forward. Simon Goldman Sachs JBWere Disclosure of Interest ORG: Goldman Sachs JBWere and/or its affiliates expect to receive or intend to seek compensation for financial and advisory services in the next 3 months from the company, its parent, or its wholly owned or majority owned subsidiary. GOLDMAN SACHS JBWERE PTY LTD DISCLAIMER Goldman Sachs JBWere Pty Ltd and its related entities distributing this document and each of their respective directors, officers and agents ("the Goldman Sachs JBWere Group") believe that the information contained in this document is correct and that any estimates, opinions, conclusions or recommendations contained in this document are reasonably held or made as at the time of compilation. However, no warranty is made as to the accuracy or reliability of any estimates, opinions, conclusions, recommendations (which may change without notice) or other information contained in this document and, to the maximum extent permitted by law, the Goldman Sachs JBWere Group disclaims all liability and responsibility for any direct or indirect loss or damage which may be suffered by any recipient through relying on anything contained or omitted from this document. Goldman Sachs JBWere does not represent or warrant the attached files are free from computer viruses or other defects. The attached files are provided, and may only be used, on the basis that the user assumes all responsibility for any loss, damage or consequence resulting directly or indirectly from use. --------------------------------------------------------------------- To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org For additional commands, e-mail: log4j-dev-help@logging.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org For additional commands, e-mail: log4j-dev-help@logging.apache.org