티스토리 뷰
Top .NET 로깅 프레임웍 비교
log4net, NLog, Serilog
log4net
- 2001년에 나옴, 오래되어 많이 쓰여짐
- 오래되어서 .NET Core 에 딱 맞진 않음
- log4net.config XML 작성 => 어렵다, 코드로 할 수 있는데 문서가 잘 안되어있음
- 전반적으로 문서가 잘 안되어있음
NLog
- 얘도 오래됨 2006년에 나옴, 최신 2017.12
- config XML 작성 필요, log4net 보다는 깔끔, 코드로 할 수 있음
- log4net 보다 설정이 쉽고, 코드 기반 설정도 제공
- 뭐든 작성을 잊어버리면 어디가 문제인지 찾아주지 못함
- 로깅하다가 어플리케이션을 망가트리면 안되는데.. 로깅이 실패하면 fatal 에러가 되어버림, 로깅은 나중일이어야 함
Serilog
- 2013년에 나옴
- 위의 두가지와 가장 큰 차이는 얘는 어플리케이션의 out of the box에서 로깅 하도록 디자인 되어있다는 점
- 설치는 위의 두가지보단 어려움
- 모듈화 하기는 쉬움
- XML 필요없음 => 설정이 쉬움
- 다양한 destination을 제공 https://github.com/serilog/serilog/wiki/Provided-Sinks
- Retrace 제공 https://stackify.com/retrace/
출처 : https://stackify.com/nlog-vs-log4net-vs-serilog/
stackify.com
Serilog
Advantages
- Structured logging and enrichment
- Great documentation and community
- C# based configuration
Disadvantages
- More features to learn
log4net
Advantages
- A lot of documentation and blog posts
- Easy to understand when coming from logging frameworks from other languages
Disadvantages
- No structured logging
- Hard to configure
- Project seems dead
출처 : https://blog.elmah.io/serilog-vs-log4net/
Serilog vs log4net - A battle between the old and the new
Serilog and log4net are popular choices when choosing a logging framework in .NET. Read this guide to learn all about each framework and what to pick.
blog.elmah.io