tell me where to put the xml file with the settings? same file and perperty?

Closed due to the fact that the essence of the question is not clear to the participants user207618, cheops , Denis , αλεχολυτ , Kirill Stoianov 22 Sep '16 at 7:37 .

Try to write more detailed questions. To get an answer, explain what exactly you see the problem, how to reproduce it, what you want to get as a result, etc. Give an example that clearly demonstrates the problem. If the question can be reformulated according to the rules set out in the certificate , edit it .

  • how to understand the root of the project? - Shirak Arshakyan
  • if you have a maven project then in the src / main / resources folder called log4j.xml, the same with properties - Andrey Sibirkin

1 answer 1

At the root of the project, for example. The fact is that in Log4j it is possible to configure itself automatically during initialization. Well, the search algorithm is as follows :

If you’re a log4j.configurationFile " If the property is set, the configurationFactory will look for log4j2-test.properties in the classpath. If you find the YAML ConfigurationFactory, it will look for log4j2-test.yaml or log4j2-test.yml in the classpath. If you find the JSON, the ConfigurationFactory will look for log4j2-test.json or log4j2-test.jsn in the classpath. If no such file is found, the XML ConfigurationFactory will look for log4j2-test.xml in the classpath. If a test file cannot be located the properties ConfigurationFactory will look for log4j2.properties on the classpath. If you look at the YAML ConfigurationFactory, it will look for log4j2.yaml or log4j2.yml on the classpath. If the JSON file cannot be found, the JSON ConfigurationFactory will look for log4j2.json or log4j2.jsn on the classpath. If the XML ConfigurationFactory is trying to locate log4j2.xml on the classpath If there is no configuration, the configuration file will be located. This will cause the logging output to go to the console.