Complete the code to create a logger instance using SLF4J in a Spring Boot class.
private static final Logger logger = LoggerFactory.[1](MyClass.class);
Use LoggerFactory.getLogger(ClassName.class) to create a logger instance in SLF4J.
Complete the code to log an informational message using SLF4J logger.
logger.[1]("Application started successfully.");
Use info method to log informational messages.
Fix the error in the Logback configuration snippet to set the root logger level to DEBUG.
<configuration> <root level="[1]"> <appender-ref ref="STDOUT" /> </root> </configuration>
Logback levels are case-sensitive and should be uppercase like DEBUG.
Fill both blanks to define a console appender in Logback XML configuration.
<appender name="STDOUT" class="ch.qos.logback.core.[1]Appender"> <encoder> <pattern>[2]</pattern> </encoder> </appender>
The console appender class is ConsoleAppender and the pattern shows timestamp, thread, level, logger, and message.
Fill all three blanks to create a logger and log a warning message with a variable in a Spring Boot class.
private static final Logger logger = LoggerFactory.[1](MyService.class); public void checkStatus(String status) { logger.[2]("Status is: {}", [3]); }
Create the logger with getLogger, log a warning with warn, and pass the variable status as argument.