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: ConfigurationBuilder in Programmatic Configuration
Date Fri, 01 Nov 2019 18:04:06 GMT
ConfiguratoinBiulder will create a full configuration. If you want to merge it with a configuration
generated from a file you could use a CompositeConfiguration.  In that case you would do something
like:


List<AbstractConfiguration> list = new ArrayList<>();
list.add(ctx.getConfiguration()); // Get existing file-based configuration.
List.add(builder.build()); // Use the builder to create an additional configuration.
ctx.setConfiguration(new CompositeConfiguration(list));  // Merge the configurations and set
the resulting configuration as active.

Ralph


> On Nov 1, 2019, at 9:41 AM, Fred Eisele <fredrick.eisele@gmail.com> wrote:
> 
> ref:
> https://logging.apache.org/log4j/2.x/manual/customconfig.html#ConfigurationBuilder
> 
> The ConfigurationBuilder is demonstrated in [
> * https://logging.apache.org/log4j/2.x/manual/customconfig.html#Example
> * https://logging.apache.org/log4j/2.x/manual/customconfig.html#Configurator
> ] but not in [
> * https://logging.apache.org/log4j/2.x/manual/customconfig.html#Hybrid
> *
> https://logging.apache.org/log4j/2.x/manual/customconfig.html#AddingToCurrent
> ].
> 
> Is this because it can/should not be used in those cases?
> 
> I would like do a hybrid configuration in which "configure(s) with a
> configuration file but do(es) some additional programmatic configuration".
> In addition I am wondering if I could use the configuration factory to
> regenerate the logging context.
> The idea is that the factory would retain custom information that would be
> applied in the case of an automatic reload.
> Is there a way to trigger an automatic reload?



---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Mime
View raw message