logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Clément Guillaume <cguilla...@hotpads.com>
Subject Re: Custom ConfigurationFactory not loaded
Date Fri, 01 Aug 2014 03:30:56 GMT
What is the equivalent properties file, considering that I use a custom
file format and a custom parser ?

Clément


On Thu, Jul 31, 2014 at 7:37 PM, Matt Sicker <boards@gmail.com> wrote:

> 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ément Guillaume <cguillaume@hotpads.com> wrote:
>
> > Oh ! I did this because of the documentation available here:
> >
> >
> http://logging.apache.org/log4j/2.x/manual/extending.html#ConfigurationFactory
> >
> > The second method is by defining the ConfigurationFactory as a Plugin.
> >
> >
> > And why all others ConfigurationFactories are declared as @Plugin ?
> >
> > @Plugin(name = "JsonConfigurationFactory", category =
> > > "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ément
> >
> >
> > On Thu, Jul 31, 2014 at 7:04 PM, Remko Popma <remko.popma@gmail.com>
> > 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ément Guillaume <cguillaume@hotpads.com>
> > > 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 = "ConfigurationFactory", name =
> > > > "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
> the
> > > name
> > > > of my class before creating a logger, my factory is successfully
> > loaded.
> > > >
> > > > Did I made a mistake declaring my ConfigurationFactory ?
> > > >
> > > > Clément
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> > > For additional commands, e-mail: log4j-user-help@logging.apache.org
> > >
> > >
> >
>
>
>
> --
> Matt Sicker <boards@gmail.com>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message