Reputation: 157
I'm trying to configure Spring (non boot) MVC project with log4j2 logging capabilities. Currently I've placed all *.properties
files in a location that is not in the class path. I've used @PropertySource
annotation for this configuration. I'm getting below message
ERROR StatusLogger No Log4j 2 configuration file found.
Using default configuration (logging only errors to the console), or user programmatically provided configurations.
Set system property 'log4j2.debug' to show Log4j 2 internal initialization logging.
See https://logging.apache.org/log4j/2.x/manual/configuration.html for instructions on how to configure Log4j 2
Any clue on how and where I've done wrong? if there are good references to check please do share.
Upvotes: 0
Views: 1394
Reputation: 11
Add log4j2-web package into project, and then add listener on web.xml:
<listener>
<listener-class>org.apache.logging.log4j.web.Log4jServletContextListener</listener-class>
</listener>
and you can set configure path here:
<context-param>
<param-name>log4jConfiguration</param-name>
<param-value>file:///D:/conf/myLogging.xml</param-value>
</context-param>
Upvotes: 1