I would like to set the log level info depending on the environment (develop, stage, prod), in a spring app. I tried creating different log4j.xml files and setting in the application.proopreties the configuration required for each env. For instance for stage I did logging.config=classpath:stage/log4j.xml
, this in the application-stage.properties.
The program compiles correctly and the files are found. I have a different log level for each env. The problem is that I'm not seeing anything in the logs. I think Spring is using the file which is located in the classpath:log4j.xml
path, because when I had a log4j.xml in this path the logs were printed with the level defined in it, and thereafter when I deleted this file, the app stoped to print the logs. I'm not pretty sure if is possible to configure this in the application.properties file and I need to do something different.