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 9CFC6116F4 for ; Sat, 6 Sep 2014 12:26:28 +0000 (UTC) Received: (qmail 49670 invoked by uid 500); 6 Sep 2014 12:26:28 -0000 Delivered-To: apmail-logging-log4j-user-archive@logging.apache.org Received: (qmail 49624 invoked by uid 500); 6 Sep 2014 12:26:28 -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 49613 invoked by uid 99); 6 Sep 2014 12:26:28 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 06 Sep 2014 12:26:28 +0000 X-ASF-Spam-Status: No, hits=2.5 required=5.0 tests=FREEMAIL_REPLY,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of lburgazzoli@gmail.com designates 74.125.82.47 as permitted sender) Received: from [74.125.82.47] (HELO mail-wg0-f47.google.com) (74.125.82.47) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 06 Sep 2014 12:26:02 +0000 Received: by mail-wg0-f47.google.com with SMTP id z12so12686345wgg.6 for ; Sat, 06 Sep 2014 05:26:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=BHwiDPohdQwnWVw9dCulbueK9+Xl68a6FwF873kR4gs=; b=OXatEvbjH2rDwaiyq9gCDe2957nWaiNIWgREX3/IlzFfdXk96LZOnUqe4tI+5zFCn0 XfMM6vmcCgRMsIPhtiVIBlGHrTI4IF44Ho5G5pYy7j3gvGGfydTrnR6zRzVLqPt68pqw vdTxe+q9zpT+ZXsqJhzHIfp88DwPBO1JPALVMnkBpPXJ77I7UnnVfbo7PFl6r9I7FiSc v1g7R7vY5qUXnlgTxs5H/9bFj5qJHiFhHzOts148Ik3kKf856QxFLcJ/EvVq6yNmuhQj l7qLMEjI1SG4VzIGOGPBTPI0w9EOgSs9w/hvwhYo5ExQS7GyUVyAiDFUd9dXDQoZCrOA Ab4w== MIME-Version: 1.0 X-Received: by 10.194.78.4 with SMTP id x4mr21286726wjw.44.1410006361362; Sat, 06 Sep 2014 05:26:01 -0700 (PDT) Received: by 10.217.182.132 with HTTP; Sat, 6 Sep 2014 05:26:01 -0700 (PDT) In-Reply-To: References: Date: Sat, 6 Sep 2014 14:26:01 +0200 Message-ID: Subject: Re: Custom appender : PluginElement From: lb To: Log4J Users List Content-Type: multipart/alternative; boundary=047d7bfcf9144cd7b2050264b061 X-Virus-Checked: Checked by ClamAV on apache.org --047d7bfcf9144cd7b2050264b061 Content-Type: text/plain; charset=UTF-8 I did a test but if the @PluginElement does not match @Plugin it fails with: 2014-09-06 14:22:26,335 ERROR BinaryVanillaChronicle contains an invalid element or attribute "chronicleConfig" 2014-09-06 14:22:26,341 ERROR TextVanillaChronicle contains an invalid element or attribute "chronicleConfig" 2014-09-06 14:22:26,344 ERROR BinaryIndexedChronicle contains an invalid element or attribute "chronicleConfig" 2014-09-06 14:22:26,348 ERROR TextIndexedChronicle contains an invalid element or attribute "chronicleConfig" On Sun, Aug 31, 2014 at 8:33 PM, Matt Sicker wrote: > I think you can use different values for @PluginElement than you do for > @Plugin which helps in the XML/JSON format. I'd have to look into this > more. > > > On 31 August 2014 10:23, lb wrote: > > > I think you should explicit state that every @PluginElement should be a > > "Plugin" then it is clear. As consequence, there is a little problem as > > you can't have two nested elements with the same name, i.e. > > > > > > > > .... > > > > > > > > > > > > .... > > > > > > > > Assume that AppenderA and AppenderB are two different appender and they > > need a specific configuration object (AppenderA.Configuration.class != > > AppenderB.Configuration.class). I would love to use Configuration for > both > > appenders but I can't as the name is set by @Plugin and @PluginElement, > am > > I wrong? > > > > > > > > > > > > > > > > > > On Sat, Aug 30, 2014 at 9:03 PM, Matt Sicker wrote: > > > > > Good to hear it! Is there anything about the documentation you found > > > unclear in that regard? > > > > > > > > > On 30 August 2014 01:44, lb wrote: > > > > > > > Yes that was the problem, I forgot to mark it as plugin. Now it > works, > > > > thank you > > > > > > > > On Friday, August 29, 2014, Matt Sicker wrote: > > > > > > > > > Is VanillaLogAppenderConfig also marked as a @Plugin and > everything? > > > > > > > > > > > > > > > On 28 August 2014 05:13, lb > > > > > wrote: > > > > > > > > > > > I'm writing a custom appender and I have a problem setting up > > > > > > PluginElement: > > > > > > > > > > > > The xml definition is the following one: > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > ${sys:java.io.tmpdir}/chronology-log4j2/conf-binary-vanilla-chronicle > > > > > > false > > > > > > false > > > > > > > > > > > > > false > > > > > > > > > > > > 128 > > > > > > > > > > > > > > > > > > > > > > > > And the PluginFactory method is: > > > > > > @PluginFactory > > > > > > public static BinaryVanillaChronicleAppender createAppender( > > > > > > @PluginAttribute("name") final String name, > > > > > > @PluginAttribute("path") final String path, > > > > > > @PluginAttribute("formatMessage") final String formatMessage, > > > > > > @PluginAttribute("includeCallerData") final String > > > > includeCallerData, > > > > > > @PluginAttribute("includeMappedDiagnosticContext") final > String > > > > > > includeMappedDiagnosticContext, > > > > > > @PluginElement("chronicleConfig") final > > VanillaLogAppenderConfig > > > > > > chronicleConfig, > > > > > > @PluginElement("filters") final Filter filter) > > > > > > > > > > > > When I run it, I have the following messages: > > > > > > 2014-08-28 12:12:29,247 ERROR appenders contains an invalid > element > > > or > > > > > > attribute "BinaryVanillaChronicle" > > > > > > 2014-08-28 12:12:29,267 ERROR Unable to locate appender > > > > > > BINARY-VANILLA-CHRONICLE for logger binary-vanilla-chronicle > > > > > > 2014-08-28 12:12:29,268 ERROR Unable to locate appender > > > > > > BINARY-VANILLA-CHRONICLE-FMT for logger > > binary-vanilla-chronicle-fmt > > > > > > 2014-08-28 12:12:29,268 ERROR Unable to locate appender > > > > > > PERF-BINARY-VANILLA-CHRONICLE for logger > > > perf-binary-vanilla-chronicle > > > > > > > > > > > > The full code is on > > > > > > > > > > > > > > > > > > > > > > > > > > > https://github.com/lburgazzoli/Chronicle-Logger/tree/HFT-CLOG-12/logger-log4j-2 > > > > > > > > > > > > What's wrong with my setup? > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > Matt Sicker > > > > > > > > > > > > > > > > > > > > > > -- > > > Matt Sicker > > > > > > > > > -- > Matt Sicker > --047d7bfcf9144cd7b2050264b061--