.NET

Logging, Monitoring & Observability

ILogger, Serilog, Application Insights, OpenTelemetry (traces, metrics), health checks, structured logging

22 คำถามสัมภาษณ์·
Mid-Level
1

What is the ILogger interface in .NET?

คำตอบ

ILogger is the standard logging interface provided by Microsoft.Extensions.Logging. It defines a uniform contract for recording messages at different severity levels, allowing abstraction of the concrete logging system implementation. This abstraction makes it easy to switch log providers without modifying application code and facilitates unit testing through dependency injection.

2

What are the log levels available in ILogger, from least to most severe?

คำตอบ

ILogger defines six ordered severity levels: Trace for detailed debugging, Debug for development information, Information for normal application flow, Warning for abnormal but non-blocking situations, Error for recoverable errors, and Critical for system failures requiring immediate intervention. This hierarchy allows filtering logs based on the environment.

3

What is the main difference between LogLevel.Debug and LogLevel.Trace?

คำตอบ

Trace is the most verbose level, intended for very detailed diagnostic information like line-by-line execution flow, while Debug contains information useful for development but less granular. In production, both are typically disabled, but Trace generates much more volume and can impact performance even in development if misused.

4

How to inject ILogger into a service class in .NET?

5

What is structured logging and what advantage does it provide?

+19 คำถามสัมภาษณ์

เชี่ยวชาญ .NET สำหรับการสัมภาษณ์ครั้งถัดไป

เข้าถึงคำถามทั้งหมด flashcards แบบทดสอบเทคนิค แบบฝึกหัด code review และตัวจำลองสัมภาษณ์

เริ่มใช้ฟรี