How to turn off debug log messages in spring boot
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.
Introduction
Turning off debug logs in Spring Boot is usually a matter of setting the right logging level, but there are two different things people often mix up: Boot's debug flag and ordinary logger levels. If you want fewer debug messages in normal application logs, the main setting is the logger level, not just the debug property.
Start with Logger Levels
The simplest way to stop debug output is to set the root logging level to INFO or higher.
In application.properties:
Or in application.yml:
That tells the logging framework not to emit DEBUG messages from loggers that inherit the root level.
Package-Specific Control Is Often Better
Sometimes you want your own code at INFO but a noisy framework package at WARN.
This is often a better real-world solution than globally raising everything, because you can quiet the noisiest libraries without losing useful application logs.
Know What the debug Flag Does
Spring Boot also has a debug property:
This property is not the same thing as setting every logger to DEBUG. It mainly turns on extra diagnostic logging for selected core Spring Boot loggers and prints more auto-configuration detail.
So if someone started the app with:
you can remove that flag or set debug=false. But for general debug logging control, logging.level.* is still the main tool.
Logback and Log4j Config Still Apply
Spring Boot uses a logging system underneath, commonly Logback by default. If you provide your own logback-spring.xml, that file can override what you thought the properties were doing.
A simple Logback root level looks like this:
If debug messages continue even after changing application.properties, check whether a custom logging configuration file is taking precedence.
Turn Off Startup Debug Noise in the Right Place
Some logs that feel like "debug noise" are actually coming from specific libraries or features, not from the root logger alone. Examples:
- SQL logging from Hibernate
- request tracing from Spring MVC filters
- actuator-related diagnostics
- custom debug logs in your own code
That is why targeted configuration is often cleaner than one blanket setting. For example:
This keeps your logs readable without hiding everything useful.
Environment-Specific Logging Helps
A good pattern is to keep development and production logging different. For example:
- development:
DEBUGfor your own package - production:
INFOorWARN
Profile-specific configuration makes that easy:
That way, you do not need to keep editing the same file every time you switch environments.
Common Pitfalls
- Assuming
debug=falsealone controls all debug log messages. - Setting the root logger correctly but forgetting a custom
logback-spring.xmloverrides it. - Turning the whole application to
WARNand losing useful operational information. - Forgetting that specific libraries may have their own noisy package loggers.
- Leaving
--debugon startup commands and then wondering why extra Boot diagnostics appear.
Summary
- The main way to turn off debug logs in Spring Boot is to raise logger levels, usually with
logging.level.root=INFO. - Use package-specific logger settings to quiet noisy frameworks without muting everything.
- Spring Boot's
debugflag is related but not identical to ordinary logging levels. - Custom Logback or Log4j configuration can override property-based settings.
- Keep logging configuration environment-specific so production stays quiet without hurting development visibility.
Related reading
- How to turn off the logging done by the ASP.NET core framework
- How to update a set of pods running in kubernetes?
- How to update docker stack without restarting all services
- How to update /etc/hosts file in Docker image during docker build
- How to turn off output from shutdown hooks in gradle boot tests?
- How to turn off the Eclipse code formatter for certain sections of Java code?
- How to understand when shedlock was acquired and released?
- how to undo a kubectl port-forward

System Design Fundamentals
Build a strong foundation in designing scalable, reliable distributed systems.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.