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 ADCAB117E5 for ; Fri, 1 Aug 2014 02:37:29 +0000 (UTC) Received: (qmail 90494 invoked by uid 500); 1 Aug 2014 02:37:29 -0000 Delivered-To: apmail-logging-log4j-user-archive@logging.apache.org Received: (qmail 90441 invoked by uid 500); 1 Aug 2014 02:37:29 -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 90425 invoked by uid 99); 1 Aug 2014 02:37:29 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 01 Aug 2014 02:37:29 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of boards@gmail.com designates 209.85.214.169 as permitted sender) Received: from [209.85.214.169] (HELO mail-ob0-f169.google.com) (209.85.214.169) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 01 Aug 2014 02:37:25 +0000 Received: by mail-ob0-f169.google.com with SMTP id nu7so2217177obb.28 for ; Thu, 31 Jul 2014 19:37:04 -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=bngqXp/vKf7tZGThgOwtV/AFBiejzxQd4Ccw2v/v4/w=; b=O3Z5LXbIGbRRSBnGYzHIM0NAtuNx00O91bBNmhVP4NUMH/WUofHGGkMxsXNPBZfGFM Tv3JQpw/gPdwDvqX6apiubmbHcts/k+GTIMTg5D4BbRJJfqvJY+a4kciHOKyyWXCoP1/ 0pWU5i34n9Ow+OhqAkqmdfZH3vBKkvMHOMsIGp6O0+4H8EMHFc7aPmU74aI0pa0kUOMq E01nVDZtHmx/T1FYMbql0chKX6HYj4MUCw9O3wvMD99nzK2MvjAvJyNqDKCqloCxhyPB NKdGalDWuZfCP2rJBpvytmVvH3zT2s00Zn0Igv2lW3ZkLq951DzLbf5UHI3WpLygRt0t M6qw== MIME-Version: 1.0 X-Received: by 10.60.132.176 with SMTP id ov16mr3182011oeb.13.1406860624061; Thu, 31 Jul 2014 19:37:04 -0700 (PDT) Received: by 10.76.128.200 with HTTP; Thu, 31 Jul 2014 19:37:04 -0700 (PDT) In-Reply-To: References: <3F4D9A2E-728F-43F0-B6F2-EBEB5210B4D0@gmail.com> Date: Thu, 31 Jul 2014 21:37:04 -0500 Message-ID: Subject: Re: Custom ConfigurationFactory not loaded From: Matt Sicker To: Log4J Users List Content-Type: multipart/alternative; boundary=047d7b472492beecf404ff884353 X-Virus-Checked: Checked by ClamAV on apache.org --047d7b472492beecf404ff884353 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable I think you may still need to set the system property (or equivalent properties file) to override the default ConfigurationFactory. On 31 July 2014 21:34, Cl=C3=A9ment Guillaume wrot= e: > Oh ! I did this because of the documentation available here: > > http://logging.apache.org/log4j/2.x/manual/extending.html#ConfigurationFa= ctory > > The second method is by defining the ConfigurationFactory as a Plugin. > > > And why all others ConfigurationFactories are declared as @Plugin ? > > @Plugin(name =3D "JsonConfigurationFactory", category =3D > > "ConfigurationFactory") > > @Order(6) > > public class JsonConfigurationFactory extends ConfigurationFactory { > > > And what should be the proper way to have a custom Configuration based on= a > custom file format ? > > Regards, > > Cl=C3=A9ment > > > On Thu, Jul 31, 2014 at 7:04 PM, Remko Popma > wrote: > > > The configuration factory is responsible for parsing a config file and > > creating a Configuration object. As such, it must exist _before_ the > > configuration file is processed. > > > > Log4j plugins are only created during processing of the config file. So= a > > configuration factory cannot be a plugin. > > > > Best regards, > > Remko > > > > Sent from my iPhone > > > > > On 2014/08/01, at 10:18, Cl=C3=A9ment Guillaume > > wrote: > > > > > > Hi, > > > > > > I'm trying to use a custom ConfigurationFactory. I created and > annotated > > it > > > with a @Plugin and an @Order like this: > > > > > > @Plugin(category =3D "ConfigurationFactory", name =3D > > > "StartupConfigurationFactory") > > > @Order(10) > > > public class StartupConfigurationFactory extends ConfigurationFactory= { > > > ... > > > } > > > > > > But it is never loaded (none of the 2 methods are called). > > > > > > If I specify the system property "log4j.configurationFactory" with th= e > > name > > > of my class before creating a logger, my factory is successfully > loaded. > > > > > > Did I made a mistake declaring my ConfigurationFactory ? > > > > > > Cl=C3=A9ment > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org > > For additional commands, e-mail: log4j-user-help@logging.apache.org > > > > > --=20 Matt Sicker --047d7b472492beecf404ff884353--