Return-Path: Delivered-To: apmail-logging-log4j-user-archive@www.apache.org Received: (qmail 8181 invoked from network); 18 Feb 2011 14:02:17 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 18 Feb 2011 14:02:17 -0000 Received: (qmail 9836 invoked by uid 500); 18 Feb 2011 14:02:17 -0000 Delivered-To: apmail-logging-log4j-user-archive@logging.apache.org Received: (qmail 9448 invoked by uid 500); 18 Feb 2011 14:02:14 -0000 Mailing-List: contact log4j-user-help@logging.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Log4J Users List" Reply-To: "Log4J Users List" Delivered-To: mailing list log4j-user@logging.apache.org Received: (qmail 9439 invoked by uid 99); 18 Feb 2011 14:02:12 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 18 Feb 2011 14:02:12 +0000 X-ASF-Spam-Status: No, hits=0.0 required=5.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [195.4.92.97] (HELO mout7.freenet.de) (195.4.92.97) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 18 Feb 2011 14:02:04 +0000 Received: from [195.4.92.22] (helo=12.mx.freenet.de) by mout7.freenet.de with esmtpa (ID a31bd12e@freenet.de) (port 25) (Exim 4.72 #3) id 1PqQtz-0005P9-0p for log4j-user@logging.apache.org; Fri, 18 Feb 2011 15:01:43 +0100 Received: from p57bc9e31.dip0.t-ipconnect.de ([87.188.158.49]:2853 helo=[192.168.41.10]) by 12.mx.freenet.de with esmtpsa (ID a31bd12e@freenet.de) (TLSv1:CAMELLIA256-SHA:256) (port 465) (Exim 4.72 #3) id 1PqQty-0001Ew-Qr for log4j-user@logging.apache.org; Fri, 18 Feb 2011 15:01:42 +0100 Message-ID: <4D5E7BC6.9010402@freenet.de> Date: Fri, 18 Feb 2011 15:01:42 +0100 From: Martin Nyolt User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.2.13) Gecko/20101207 Lightning/1.0b2 Thunderbird/3.1.7 MIME-Version: 1.0 To: log4j-user@logging.apache.org Subject: Log4j closes System.err Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hello, I use the following code to load a default configuration in case no configuration was set using the log4j.configuration property: static { LOGGER = Logger.getLogger(MyClass.class); Logger root = Logger.getRootLogger(); boolean inited = root.getAllAppenders().hasMoreElements(); if (!inited) { Layout layout = new PatternLayout("%-5p [%t]: %m%n"); // create Appender to System.err ConsoleAppender app = new ConsoleAppender(layout, ConsoleAppender.SYSTEM_ERR); // set the follow option app.setFollow(true); app.activateOptions(); root.addAppender(app); root.setLevel(Level.ERROR); } } If I don't call "app.activateOptions()", the follow-option wouldn't take effect (and I do need "follow" to be true). But activateOptions finally calls WriterAppender.reset, which calls ConsoleAppender.close and closes the previous output stream, in this case System.err - but closing System.err is not a good idea, as it is still needed - I just want to change the Follow-Option. Is this a misbehaviour of log4j, or am I incorrectly using the API? Best regards Martin Nyolt --------------------------------------------------------------------- To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org For additional commands, e-mail: log4j-user-help@logging.apache.org