Challenge - 5 Problems
Log Level Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ component_behavior
intermediate2: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"); } }
Attempts:
2 left
💡 Hint
INFO level shows messages at INFO and above severity.
✗ Incorrect
At INFO level, messages logged at INFO, WARN, and ERROR levels are shown. TRACE and DEBUG are lower levels and are not printed.
📝 Syntax
intermediate1:30remaining
Which log level setting disables all logging?
In Spring Boot's application.properties, which log level setting disables all logging output?
Attempts:
2 left
💡 Hint
Check the official log level names for disabling logs.
✗ Incorrect
The OFF level disables all logging. NONE and DISABLE are not valid log levels. ERROR still allows error logs.
🔧 Debug
advanced2: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?
Attempts:
2 left
💡 Hint
Check the exact package name used in the logger declaration.
✗ Incorrect
Log level settings apply to package names. If the logger uses a different package or class name, the setting won't apply.
🧠 Conceptual
advanced2: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).
Attempts:
2 left
💡 Hint
TRACE logs everything, ERROR logs only errors.
✗ Incorrect
TRACE is the most detailed, followed by DEBUG, INFO, WARN, and ERROR as the least detailed.
❓ state_output
expert3: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?
Attempts:
2 left
💡 Hint
More specific package settings override broader ones.
✗ Incorrect
The com.example.service package is set to ERROR level, so only ERROR messages print from MyService. The DEBUG level on com.example does not apply here.