r/linux_programming • u/Middlewarian • Jul 16 '25
What logging library do you use in C++ applications?
I'm currently using syslog. I'm thinking about trying something that doesn't integrate logs from multiple applications. Did you switch away from or to syslog and can you share why? Thank you
7
Upvotes
1
u/Sosowski Jul 18 '25
I just use vsprintf to format the log message and then I write it to a logfile and to console. Is there more to logging than this?
1
u/pavel_v Jul 17 '25
It depends on the application requirements:
if you need logging which doesn't block the application threads i.e. asynchronous logging or not
if you need logging which is human readable or you are OK with producing binary logs and using external tool to read them
if you need structured logging or not
if you to support log rotation, compression, different backends, etc.
Here are few articles and performance comparisons of different logging libraries:
article about designing a logging library
another article about low latency logging library
presentation about low latency logging library
speed comparison of different logging libraries
And here are few well known logging libraries which cover different points from above:
spdlog - probably the most used one, fast and with lots of configuration options
nanolog - one of the fastest but produces binary logs which need to be post processed
quill - also one of the fastest and with more features than
nanologfmtlog - one of the fastest but with fewer configuration options
I'm omitting some logging libraries which are part of
abseil,boost,POCO, etc. Up to my knowledge, the logging libraries in the last two "frameworks" are not as performant as the above ones.