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 และตัวจำลองสัมภาษณ์

เริ่มใช้ฟรี