## ๐Ÿ“œ [Spring Boot] Why My `log.trace()` and `log.debug()` Werenโ€™t Showing โ€“ And How I Fixed It

Yeeunยท2025๋…„ 4์›” 17์ผ
0

SpringBoot

๋ชฉ๋ก ๋ณด๊ธฐ
5/46

๐Ÿ“œ [Spring Boot] Why My log.trace() and log.debug() Werenโ€™t Showing โ€“ And How I Fixed It

While testing my Spring Boot app, I wanted to log messages at different levels using Lombokโ€™s @Slf4j. But something was off...


๐Ÿงช What I Did

I created a class that logs messages when the app starts:

@Slf4j
@Service
public class LogginRunner implements ApplicationRunner {
	@Override
	public void run(ApplicationArguments args) throws Exception {
		log.trace("TRACE ๋กœ๊ทธ ๋ฉ”์„ธ์ง€");
		log.debug("DEBUG ๋กœ๊ทธ ๋ฉ”์„ธ์ง€");
		log.info("INFO ๋กœ๊ทธ ๋ฉ”์„ธ์ง€");
		log.warn("WARN ๋กœ๊ทธ ๋ฉ”์„ธ์ง€");
		log.error("ERROR ๋กœ๊ทธ ๋ฉ”์„ธ์ง€");
	}
}

โ“ What Happened?

Only these showed in the console:

INFO ๋กœ๊ทธ ๋ฉ”์„ธ์ง€  
WARN ๋กœ๊ทธ ๋ฉ”์„ธ์ง€  
ERROR ๋กœ๊ทธ ๋ฉ”์„ธ์ง€

But my TRACE and DEBUG logs were completely missing.


๐Ÿ’ก The Reason

Spring Boot sets the default log level to INFO.
This means anything below that (TRACE, DEBUG) wonโ€™t show up unless you manually allow them.


๐Ÿ› ๏ธ The Fix

I updated my application.properties:

logging.level.ruby.paper=trace

๐Ÿ” This tells Spring:

"Show all logs (even the very detailed ones) for anything under the ruby.paper package."

After restarting, all log levels appeared, including TRACE and DEBUG.


๐Ÿ” Bonus Tip: Set Level by Category

You can also target different packages or globally:

# For everything
logging.level.root=debug

# For a specific package
logging.level.com.example.service=debug

โœ… Summary

ProblemFix
TRACE and DEBUG not showingAdd logging.level.package=trace in application.properties
Default log level is too highSpring Bootโ€™s default is INFO, so lower ones are hidden

๐Ÿ“˜ Final Thought

Logging levels help you see just the right amount of info at the right time. If something isnโ€™t showing โ€” check your logging level first!

0๊ฐœ์˜ ๋Œ“๊ธ€