0
0
Spring Bootframework~20 mins

Log levels (TRACE, DEBUG, INFO, WARN, ERROR) in Spring Boot - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Log Level Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
component_behavior
intermediate
2:00remaining
What log messages appear at INFO level?
Given the Spring Boot application configured with log level INFO, which log messages will be printed to the console?
Spring Boot
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class LogExample {
    private static final Logger logger = LoggerFactory.getLogger(LogExample.class);

    public static void main(String[] args) {
        logger.trace("Trace message");
        logger.debug("Debug message");
        logger.info("Info message");
        logger.warn("Warn message");
        logger.error("Error message");
    }
}
AOnly 'Error message' is printed.
BOnly 'Info message', 'Warn message', and 'Error message' are printed.
CAll messages from 'Trace message' to 'Error message' are printed.
DOnly 'Warn message' and 'Error message' are printed.
Attempts:
2 left
💡 Hint
INFO level shows messages at INFO and above severity.
📝 Syntax
intermediate
1:30remaining
Which log level setting disables all logging?
In Spring Boot's application.properties, which log level setting disables all logging output?
Alogging.level.root=OFF
Blogging.level.root=ERROR
Clogging.level.root=DISABLE
Dlogging.level.root=NONE
Attempts:
2 left
💡 Hint
Check the official log level names for disabling logs.
🔧 Debug
advanced
2:30remaining
Why does DEBUG log not appear despite setting DEBUG level?
A developer sets logging.level.com.example=DEBUG in application.properties but DEBUG messages from com.example.service.MyService do not appear. What is the most likely cause?
AThe root log level is set to ERROR, which overrides package settings.
BThe application.properties file is not loaded at runtime.
CThe logging framework does not support DEBUG level.
DThe logger in MyService is using a different package name than com.example.service.
Attempts:
2 left
💡 Hint
Check the exact package name used in the logger declaration.
🧠 Conceptual
advanced
2:00remaining
What is the order of log levels from most to least detailed?
Arrange the log levels from the most detailed (shows most messages) to the least detailed (shows fewest messages).
A1,2,3,4,5
B5,4,3,2,1
C3,2,1,4,5
D2,1,3,4,5
Attempts:
2 left
💡 Hint
TRACE logs everything, ERROR logs only errors.
state_output
expert
3:00remaining
What is the output count of WARN and ERROR logs with mixed package levels?
Given these log level settings in application.properties: logging.level.com.example=DEBUG logging.level.com.example.service=ERROR And this code: import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class MyService { private static final Logger logger = LoggerFactory.getLogger(MyService.class); public void run() { logger.debug("Debug message"); logger.info("Info message"); logger.warn("Warn message"); logger.error("Error message"); } } How many log messages will be printed when run() is called?
A'Debug', 'Info', 'Warn', and 'Error' messages are printed (4 messages).
B'Warn message' and 'Error message' are printed (2 messages).
COnly 'Error message' is printed (1 message).
D'Info', 'Warn', and 'Error' messages are printed (3 messages).
Attempts:
2 left
💡 Hint
More specific package settings override broader ones.