From log4j-dev-return-12808-apmail-logging-log4j-dev-archive=logging.apache.org@logging.apache.org Mon Oct 02 18:12:40 2006 Return-Path: Delivered-To: apmail-logging-log4j-dev-archive@www.apache.org Received: (qmail 5702 invoked from network); 2 Oct 2006 18:12:40 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 2 Oct 2006 18:12:40 -0000 Received: (qmail 44992 invoked by uid 500); 2 Oct 2006 18:12:35 -0000 Delivered-To: apmail-logging-log4j-dev-archive@logging.apache.org Received: (qmail 44919 invoked by uid 500); 2 Oct 2006 18:12:34 -0000 Mailing-List: contact log4j-dev-help@logging.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: 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 44879 invoked by uid 99); 2 Oct 2006 18:12:34 -0000 Received: from idunn.apache.osuosl.org (HELO idunn.apache.osuosl.org) (140.211.166.84) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 02 Oct 2006 11:12:34 -0700 X-ASF-Spam-Status: No, hits=0.0 required=5.0 tests= Received: from [195.112.81.7] ([195.112.81.7:64953] helo=mail.ergonomics.ch) by idunn.apache.osuosl.org (ecelerity 2.1.1.8 r(12930)) with ESMTP id B7/F3-24395-D8651254 for ; Mon, 02 Oct 2006 11:12:31 -0700 X-MimeOLE: Produced By Microsoft Exchange V6.0.6603.0 Content-Class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: Enhanced FileAppender Date: Mon, 2 Oct 2006 20:12:26 +0200 Message-ID: <3FE38194C8A3334A959B64B7D9A1E27B6E3185@plejaden.seychelles.ergo> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Enhanced FileAppender thread-index: AcbmTlD9UUZ4xnJLRpWTyE3yU1gHWQ== From: "Bender Heri" To: X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Hello all Since in user list nobody commented my suggestion for an enhancement of = the FileAppender I will repeat it here. Problem: A often asked issue in user list is the problem to separate log files = dependent on different criterias, like a client-ID in a server = environment, a mandant- or task-ID in scheduler applications, etc. = Although it is possible to achieve this with the existing log4j = framework all possible solutions are quite complex or have other = drawbacks (own repository selector, working with different classloaders, = subclass concrete descendents of FileAppender). Solution: The FileAppender is supplied with a property of type FileNameBuilder = (Design pattern: visitor). The user-supplied implementation of this = Interface can build a filename based on whatever criterias (i.e. MDC, = global Environment, etc.). The visitor is called each time a = Fileappender wants to append a log message. The FileAppender holds a = collection of file writers for each separate file name delivered by = FileNameBuilder. To avoid the excess of open file handles the FileAppender could watch = the logging activity to one particular file. If the file was not = accessed after let's say one hour it could be closed (this timeout could = also be configurable). Special care must be done if the property = "append" of the FileAppender is false. If the file was closed because = the above timeout had elapsed and then reopened later again, the file = shouldn't be overridden. If the config file does not specify a FileNameBuilder a default = implementation would be used which returns always the configured = filename. This wouldn't break existing code. The existing property = fileName would remain and hold always the configured filename. The interface of the FileNameBuilder would be like this: public String buildFilename( FileAppender aFileAppender ); Any comments on this? Heri --------------------------------------------------------------------- To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org For additional commands, e-mail: log4j-dev-help@logging.apache.org