logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ralph Goers <ralph.go...@dslextreme.com>
Subject Re: Custom ConfigurationFactory not loaded
Date Fri, 01 Aug 2014 05:26:15 GMT
Your annotations are correct. However, in the code snippet below you don’t show what getSupportedTypes()
returns. The generic ConfigurationFactory inspects all the ConfigurationFactory plugins using
the order to determine which should be inspected first, second, etc.  It calls getSupportedTypes
to find out what file extensions the ConfigurationFactory handles. If the provided configuration
file matches one of the file extensions than that factory will be used.  “*” is used as
a wildcard to specify that it handles any file extension (which is what the XMLConfigurationFactory
does).  However, with an Order of 10 if you specified a “*” I believe your factory would
have to handle XML, JSON and YAML configurations.

I would suggest having getSupportedTypes return something like “.cfg” and then having
your configuration files end with .cfg.


On Jul 31, 2014, at 6:18 PM, 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

View raw message