I need to disable application logs in console for my web application. I have below logback-spring.xml to force spring to use file appender instead of console appender. However, the problem now is my application log is written with all the logs from all the packages, even from those that are not specified in the logback-spring.xml
<?xml version="1.0" encoding="UTF-8"?>
<include resource="org/springframework/boot/logging/logback/defaults.xml" />
<include resource="org/springframework/boot/logging/logback/file-appender.xml" />
<springProfile name="local,dev,qa,prodsup,perftest">
<logger name="org.application.folder" level="debug" />
<logger name="org.springframework.*" level="debug" />
<root level="debug">
<appender-ref ref="FILE" />
</root>
</springProfile>
<springProfile name="prod">
<logger name="org.application.folder" level="error" />
<logger name="org.springframework.core " level="error" />
<logger name="org.springframework.beans" level="error" />
<logger name="org.springframework.context" level="error" />
<logger name="org.springframework.transaction" level="error" />
<logger name="org.springframework.web" level="error" />
<logger name="org.springframework.test" level="error" />
<logger name="org.springframework.boot.context" level="error"/>
</springProfile>
I am using spring boot 1.5.2. I specified the log file location in application.properties using logging.file key. I am currently using Websphere but I face the same problem with embedded tomcat as well.
Thank you.
logback-spring.xmlat all? Maybe Logback is initialising itself from a different file, perhaps it foundlogback.xmlorlogback-test.xmlon the classpath before yourlogback-spring.xml. Or maybe it couldn't find any configuration files on the classpath so it is running with the default configuration. If you run your application with-Dlogback.debug=truethen Logback will write log messages (to console) whcih tell you where it configured itself from. - glytching