Console logging in development is a must, but it would be nice to have a simple way to disable console logging in non-development environments, ideally without the need to create and maintain logback xml.

Our current solution:

  • In development (application.properties) we have no additional logging configuration as the defaults work great!
  • In production (application-prod.properties) we log to a file and disable (via a hack) console logging:
logging.pattern.console =
logging.level.root = WARN
logging.file.name = /var/log/app_logs/WebApp.log

This approach is based on a tip from https://www.baeldung.com/spring-boot-disable-console-logging#logback

Alternatively, we can avoid creating the XML file by overriding the default configuration with application properties. For example, we can potentially make use of the logging.pattern.console property:

logging.pattern.console=

Since upgrading to Spring Boot 3.5.4 (from 3.4) we see this error in Tomcat's catalina.out reminding us of this workaround:

-ERROR in ch.qos.logback.classic.PatternLayout("") - Empty or null pattern.

Is it feasible and appropriate to add a configuration property to disable console logging? This idea has been hinted at in the past.