Spring Boot Logging - SLF4J, Logback

    Question 1CORE SPRING BOOT - Purpose of SLF4J

    What is the primary purpose of SLF4J in Spring Boot?

    Question 2CORE SPRING BOOT - Logback Integration

    Which logging framework is used by default in Spring Boot?

    Question 3CORE SPRING BOOT - Logging Levels

    Which of the following is not a standard logging level in SLF4J/Logback?

    Question 4CORE SPRING BOOT - Code Snippet (SLF4J Logging)

    What will the following code output if the logging level is set to INFO?

    import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class LoggingExample { private static final Logger logger = LoggerFactory.getLogger(LoggingExample.class); public void run() { logger.debug("Debug message"); logger.info("Info message"); logger.error("Error message"); } }

    Question 5CORE SPRING BOOT - Configuring Logging in application.properties

    How can you set the logging level for a specific package in Spring Boot using application.properties?

    Question 6CORE SPRING BOOT - Code Snippet (Logging in a Spring Component)

    What will happen when this component is executed?

    @Component public class MyService { private static final Logger logger = LoggerFactory.getLogger(MyService.class); public void process() { logger.info("Processing started"); } }

    Question 7CORE SPRING BOOT - Code Snippet (Custom Logback Configuration)

    Consider the following logback-spring.xml snippet. What does it do?

    <logger name="com.example" level="DEBUG"/> <root level="INFO"> <appender-ref ref="CONSOLE"/> </root>

    Question 8CORE SPRING BOOT - Logging in YAML

    How do you configure logging levels in application.yml?

    Question 9CORE SPRING BOOT - Best Practices for Logging

    Which of the following is considered a best practice for logging in Spring Boot?

    Question 10CORE SPRING BOOT - Code Snippet (Parameterized Logging)

    What will the following SLF4J code output if userId = 101?

    logger.info("Processing user with id: {}", userId);