Can you provide a PR that demonstrates what you would like to do? It is easier for me to evaluate the pros and cons of that then guessing what the implementation would look like.
Ralph > On Dec 31, 2019, at 2:43 PM, Volkan Yazıcı <[email protected]> wrote: > > A majority of the Log4j 2.0 constants are structured by means of > "public final" fields initialized via system properties. While this > serves great for accessibility, IMHO, becomes an obstacle for tests. > For instance, I have needed two maven-surefire-plugin executions for > log4j2-logstash-layout: one with TLA enabled and another one with TLA > disabled. I have tried invoking System.setProperty() to influence > these constants for tests via both "static { }" blocks and > @BeforeClass methods, but neither kicks in earlier than the Log4j > constant class initialization itself. Is it just me that couldn't get > it working or this approach indeed hampers testing? If the latter, for > Log4j 3.0, I propose using injection to pass configuration state > rather than accessing it via globals. >
