Spring Boot

Logging with SLF4J & Logback

Logging with SLF4J and Logback, log levels, configuration, appenders, patterns, package-level logging

20 питань зі співбесід·
Junior
1

What is SLF4J in the Java ecosystem?

Відповідь

SLF4J (Simple Logging Facade for Java) is an abstraction facade for various Java logging frameworks (Logback, Log4j, JUL). It allows decoupling application code from the concrete logging implementation, making it easy to change frameworks without modifying business code. Spring Boot uses SLF4J with Logback as the default implementation.

2

What is the default logging implementation in Spring Boot?

Відповідь

Logback is the default logging implementation in Spring Boot. Developed by the creator of Log4j, Logback offers better performance, more flexible configuration, and native SLF4J compatibility. Spring Boot includes it automatically via spring-boot-starter-logging which is a transitive dependency of all web starters.

3

How to create a Logger instance with SLF4J in a Spring class?

Відповідь

The recommended method is LoggerFactory.getLogger(ClassName.class) which creates a logger based on the fully qualified class name. This enables a consistent logger hierarchy with Java packages and simplifies configuration by package. Alternatively, Lombok provides @Slf4j which automatically generates the logger.

4

What are the standard log levels in SLF4J, from most verbose to most critical?

5

Which Spring Boot property sets the log level for a specific package?

+17 питань зі співбесід

Інші теми співбесід Spring Boot

Spring Core - IoC & DI

Junior
22 запитань

Spring Boot Auto-Configuration

Junior
20 запитань

Spring Boot Starters

Junior
18 запитань

Application Properties & YAML

Junior
16 запитань

Spring Boot DevTools

Junior
15 запитань

Spring MVC Basics

Mid-Level
20 запитань

Spring REST Controllers

Mid-Level
20 запитань

Request & Response Handling

Mid-Level
20 запитань

Exception Handling

Mid-Level
25 запитань

Bean Validation

Mid-Level
25 запитань

Spring Data JPA Basics

Mid-Level
25 запитань

JPA Entities & Relationships

Mid-Level
30 запитань

JPA Queries

Mid-Level
30 запитань

Spring Data Repositories

Mid-Level
25 запитань

Spring Security Basics

Mid-Level
25 запитань

Spring Boot Actuator

Mid-Level
20 запитань

Unit Testing with JUnit & Mockito

Mid-Level
30 запитань

Spring Boot Testing

Mid-Level
30 запитань

Profiles & Environment

Mid-Level
20 запитань

RestTemplate & WebClient

Mid-Level
24 запитань

Async & Scheduling

Mid-Level
25 запитань

Caching with Spring

Mid-Level
25 запитань

Spring WebFlux (Reactive)

Mid-Level
25 запитань

Spring Transactions

Senior
30 запитань

Advanced Authentication & Authorization

Senior
30 запитань

JWT & Stateless Security

Senior
20 запитань

OAuth2 & Authorization Server

Senior
20 запитань

Spring Boot & Docker

Senior
19 запитань

Microservices with Spring

Senior
25 запитань

Spring Cloud Config

Senior
19 запитань

Performance Optimization

Senior
30 запитань

GraalVM Native Images

Senior
20 запитань

Опануй Spring Boot для наступної співбесіди

Отримай доступ до всіх питань, flashcards, технічних тестів, вправ code review та симуляторів співбесід.

Почни безкоштовно