1

I want when my app starts to configure log4j with some default configuration. Once the other configuration (non-log4j) is parsed I get the real file-path to the real log4j configuration. Now I can fully configure log4j.

How would you do that. (java) ?

Also I prefer to use .json config file, if it matters.

sten
  • 6,266
  • 8
  • 35
  • 48

1 Answers1

0

Based on the answers to this question, it seems to be pretty complicated with log4j2 (which is what I assume you're using seeing as you're talking about using a JSON configuration file, which didn't exist in log4j 1.x as far as I know).

If you're willing to use an XML or properties log4j configuration and also step down to log4j 1.x, you can use PropertyConfigurator.configure(String) or DOMConfigurator.configure(String) depending on if you're using a properties or XML configuration file.

Community
  • 1
  • 1
Catchwa
  • 5,735
  • 3
  • 32
  • 56