[slf4j-user] Chicken/Egg configuration problem

Matt Sicker boards at gmail.com
Mon Mar 20 02:10:37 CET 2017


You could always write your configuration bootstrapping another programming
language!

In my experience, what I've usually done or seen done for managing this
sort of configuration is through application startup scripts more so than
pure Java. For example, using Mesos, I can set environment variables ahead
of time. Using config management, I can have a program to configure my
tasks before starting a Java executable entirely. It all really depends on
the deployment environment you use. I'm also curious as to what other
things you're doing before logging initialization is wanted.

Also, Commons Logging has been using the ServiceLoader method for a while,
though again, as with all the logging frameworks, initialization happens as
soon as you use a logger.

On 19 March 2017 at 06:08, Joachim Durchholz <jo at durchholz.org> wrote:

> Am 19.03.2017 um 05:50 schrieb Adam Gent:
>
>> I accidentally unsubscribed but I figured I would start a new thread
>> on what I mean by the Chicken/Egg configuration problem with SL4FJ.
>>
>> The problem is you often in cloud environments want a fully resolved
>> configuration with out doing logging.
>> .... But you can't have fully correctly configured logging with out
>> configuration being complete.... but you can't a proper configuration
>> with out using logging.
>>
>> I'm not talking about some reentrant or endless recursive calls or
>> infinite loop that the event queue in LogFactory prevents.
>>
>> Lets go over this with a configuration initialization that is agnostic
>> of logging backend.
>>
>> 1. static main - initialization
>> 2. configuration code begins
>> 3. configuration needs to set some system properties and various
>> singletons required by a backend logging framework and various other
>> downstream libraries (the best way to configure old log4j is still
>> through system properties)
>> 4. configuration code needs to get external configuration to set these
>> properties
>> 5. configuration code uses a library that has SLF4J in it (lets say
>> Zookeeper but it could be any sort of configuration library like
>> Archaius).
>> 5. SLF4J initialization begins
>> 6. Backend logging initialization begins but is missing required
>> system properties and/or singletons.
>>
>
> How this?
> Step 3 is supposed to provide all this.
>
> 7. Backend logging finishes initialization but is incorrect
>> 8. Logging events do not have correct MDC attributes but worse Logging
>> appenders may not be setup correctly.
>>
>
> Since we disagree about what problems can happen, I'm leaving discussion
> of the solutions to another thread.
>
> (I do believe you that you did have problems, I just do not agree with the
> problem description because it doesn't make sense to me - yet.)
>
> _______________________________________________
> slf4j-user mailing list
> slf4j-user at qos.ch
> http://mailman.qos.ch/mailman/listinfo/slf4j-user
>



-- 
Matt Sicker <boards at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/slf4j-user/attachments/20170319/5ae127a6/attachment.html>


More information about the slf4j-user mailing list