Return-Path: X-Original-To: apmail-camel-users-archive@www.apache.org Delivered-To: apmail-camel-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8CA3D10476 for ; Tue, 17 Sep 2013 15:40:09 +0000 (UTC) Received: (qmail 37945 invoked by uid 500); 17 Sep 2013 15:40:08 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 37865 invoked by uid 500); 17 Sep 2013 15:40:03 -0000 Mailing-List: contact users-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@camel.apache.org Delivered-To: mailing list users@camel.apache.org Received: (qmail 37815 invoked by uid 99); 17 Sep 2013 15:39:59 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 17 Sep 2013 15:39:59 +0000 X-ASF-Spam-Status: No, hits=2.3 required=5.0 tests=SPF_SOFTFAIL,URI_HEX X-Spam-Check-By: apache.org Received-SPF: softfail (athena.apache.org: transitioning domain of ford.j.martin@gmail.com does not designate 216.139.236.26 as permitted sender) Received: from [216.139.236.26] (HELO sam.nabble.com) (216.139.236.26) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 17 Sep 2013 15:39:55 +0000 Received: from [192.168.236.26] (helo=sam.nabble.com) by sam.nabble.com with esmtp (Exim 4.72) (envelope-from ) id 1VLxNG-0003kk-E7 for users@camel.apache.org; Tue, 17 Sep 2013 08:39:34 -0700 Date: Tue, 17 Sep 2013 08:39:34 -0700 (PDT) From: fordm To: users@camel.apache.org Message-ID: <1379432374429-5739684.post@n5.nabble.com> Subject: Customised Logging of Camel Route Errors and Exceptions MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Hi, We use pattern matching to tail our log files for error messages of the form: matching on "MY_ERROR_CODE_", emails are then sent automatically. I therefore need any exceptions in a camel route to be log in such a format. I'd be interested in your views on the following solution: Create an exception handler class which will wrap and re-throw the exception, e.g. where MyRuntimeException is a class and MyErrorCode is an enum that will log an error message in the required format (this is a legacy bit of code). In blueprint.xml I define an exception handler bean, camel context and a couple of error handlers thus (some code omitted for brevity): This seems to work but is it utter rubbish? What's a better solution? Thanks for any comments. -- View this message in context: http://camel.465427.n5.nabble.com/Customised-Logging-of-Camel-Route-Errors-and-Exceptions-tp5739684.html Sent from the Camel - Users mailing list archive at Nabble.com.