I have a project structure like this:
hangover webapps project name src Main Java resources log4j2.xml Web App WEB-INF web.xml lib classes log4j2.xml
So there are two possible scenarios:
log4j2.xmlis in both resources and classes folder
log4j2.xmlis located only in resources
log4j2.xmlis located only in classes
In the first scenario the code
Logger logger = LogManager.getLogger (MyClass.class); logger.debug ("debug log message"); logger.info ("Info log message"); logger.error ("error log message");
In the second scenario, it does not work in most cases, but sometimes it works and seems to copy the file classes Folder.
In the third scenario it sometimes works, sometimes it does not and deletes the file from classes,
With & # 39; work & # 39; I mean that the debug messages are printed out with & # 39; work & # 39; I mean that the error is printed
No error was found in the log4j2 configuration file,
I thought it would search for the file in the folders of the project and use it as soon as it was found without any problems. But here it only seems to work if it's in both resources and classes Folder and I do not understand why.