Return-Path: X-Original-To: apmail-logging-log4j-user-archive@www.apache.org Delivered-To: apmail-logging-log4j-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 16D2B180BE for ; Thu, 14 Jan 2016 00:28:36 +0000 (UTC) Received: (qmail 20303 invoked by uid 500); 14 Jan 2016 00:28:35 -0000 Delivered-To: apmail-logging-log4j-user-archive@logging.apache.org Received: (qmail 20254 invoked by uid 500); 14 Jan 2016 00:28:35 -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 20243 invoked by uid 99); 14 Jan 2016 00:28:35 -0000 Received: from Unknown (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Jan 2016 00:28:35 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id F0EDCC1EFB for ; Thu, 14 Jan 2016 00:28:34 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.001 X-Spam-Level: X-Spam-Status: No, score=0.001 tagged_above=-999 required=6.31 tests=[URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-us-east.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id 3C_eF2m3vC8J for ; Thu, 14 Jan 2016 00:28:22 +0000 (UTC) Received: from smtp754.redcondor.net (smtp754.redcondor.net [208.80.206.54]) by mx1-us-east.apache.org (ASF Mail Server at mx1-us-east.apache.org) with ESMTPS id AB88543BFE for ; Thu, 14 Jan 2016 00:28:22 +0000 (UTC) Received: from mailproxy12.neonova.net ([137.118.22.77]) by smtp754.redcondor.net ({97b16bb2-c597-43ea-8fbe-137c536017bc}) via TCP (outbound) with ESMTP id 20160114002815531_0754 for ; Thu, 14 Jan 2016 00:28:15 +0000 X-RC-FROM: X-RC-RCPT: Received: from [192.168.1.14] (ip72-201-43-179.ph.ph.cox.net [72.201.43.179]) (Authenticated sender: ralph.goers@dslextreme.com) by mailproxy12.neonova.net (Postfix) with ESMTPA id CBF2C360066 for ; Wed, 13 Jan 2016 19:28:11 -0500 (EST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2104\)) Subject: Re: Appender's append() method From: Ralph Goers In-Reply-To: Date: Wed, 13 Jan 2016 17:28:11 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: References: To: Log4J Users List X-Mailer: Apple Mail (2.2104) X-DLP-ENABLED: 137.118.22.64/27 X-MAG-OUTBOUND: greymail.redcondor.net@137.118.22.64/27 Sorry, that was what I meant. Ralph > On Jan 13, 2016, at 3:17 PM, Gary Gregory = wrote: >=20 > IMO a RuntimeException subclass is appropriate while RuntimeException > should not be used. >=20 > Gary >=20 > On Wed, Jan 13, 2016 at 1:53 PM, Ralph Goers = > wrote: >=20 >> Your appender is automatically wrapped by an AppenderControl object. = The >> AppenderControl will inspect the ignoreExceptions flag so your = Appender >> does not have to. Your Appender should just throw a RuntimeException = if it >> encounters a problem. >>=20 >> Ralph >>=20 >>> On Jan 13, 2016, at 2:38 PM, Nicholas Duane wrote: >>>=20 >>> I'm new to java so maybe this should be an obvious question to most = java >> developers. If I'm trying to override the append() method but also = throw >> exceptions, how is that done? >>>=20 >>> I'm asking because I assume my append method's outermost catch block = is >> to inspect the ignoreExceptions flag and either bubble up the = exception if >> ignoreExceptions is false or eat the exception otherwise, most likely = just >> logging an event. Is that true? If so, then how do I accomplish = that? I >> tried coding it as I mentioned above (actually someone else did it = for me), >> but the compiler I guess was complaining about the throw needing to = be in a >> catch block, I assume because the append() method is not defined to = throw >> exceptions. >>>=20 >>> In addition, looking at what I think was source for one of your >> appenders at: >>>=20 >>>=20 >> = https://git-wip-us.apache.org/repos/asf?p=3Dlogging-log4j2.git;a=3Dblob;f=3D= log4j-core/src/main/java/org/apache/logging/log4j/core/appender/AbstractOu= tputStreamAppender.java;h=3D9a4cfde83194c866c30c4687e9f4ebb19cb20a17;hb=3D= 75d33d96ac00356014cf11f8ad9e8c6ead4db37a >>>=20 >>> Why does it always throw an exception in the catch block instead of >> checking the state of the ignoreExceptions flag? >>>=20 >>> Thanks, >>> Nick >>>=20 >>=20 >>=20 >>=20 >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org >> For additional commands, e-mail: log4j-user-help@logging.apache.org >>=20 >>=20 >=20 >=20 > --=20 > E-Mail: garydgregory@gmail.com | ggregory@apache.org > Java Persistence with Hibernate, Second Edition > > JUnit in Action, Second Edition > Spring Batch in Action > Blog: http://garygregory.wordpress.com > Home: http://garygregory.com/ > Tweet! http://twitter.com/GaryGregory --------------------------------------------------------------------- To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org For additional commands, e-mail: log4j-user-help@logging.apache.org