I have a mavenized project running on tomcat 8.5 .
I have a configuration according to a specific regulation for the logs. I am using log4j version 1.2.14 and I have my log4j.properties in my resource location (I have also tried to change that file location), that location is
src/main/filteredResources.
For other projects in which I have had to do the same, it has worked without problems, but of course, I used spring and I had to initialize the bean with the call to the file path. Without it, it did not show the log on the console nor did it create the logs file in the specified path. For this project struts is used and from what I have investigated, adding the properties in the root would be enough, but this has not been successful either.
The strange thing is that it shows me some logs on the console without having anything configured, but they are not in the format I want and I have them in log4j.properties .
After this, I used the parameter:
-Dlog4j.configuration=log4j.properties
This paints it on my locale, but I need it to keep working once deployed to other environments. Is there a real alternative to this?
Does anyone know how I could fix this?
Finally, it was added in the
web.xml
onecontext-param
referring to the location of the file:Later, the
contextListener
following was added to make the file and paint it according to my configuration:With this I got it to recognize my configuration.
I add as additional information, that being a modulated project it was necessary to do this, because for this reason it did not recognize the log4j.properties file where it was.