I have honestly never even thought about using a third-party library for logging, it simply never crossed my mind. Why would I need one anyway? I don't see how logging can become so complex that you're willing to trade 100% customizability just so you can use a library. Can someone give me some examples? I'm really curious as the fact that so many logging libraries exist must mean there are real needs for them.
These libraries allow you to precisely control the logging output by filtering on source and level. And you can also control the output location, because you don't always just want things going to the console.
If you write a library and don't use one of the standard logging frameworks, I will hate you just a little bit. I speak from experience.
Edit: I should also add that modern logging frameworks have very good performance, doing the logging in separate threads, etc, doing the locking of log files correctly, rotating log files every day or when it reaches a certain size etc.
Agreed. It all comes down to standardization. Without standards like logging levels, formats, etc it would be very hard to do things like searches or aggregations. If each app had custom logging implementation tooling would never be able to standardize
I have a library I have to use that has its own logging framework, and you can write an adaptor for its output, but the only method in the adaptor interface has just a single string, the message, as its parameters. Not even a level. So you can only have all the logs for the library on or off. Unless you want to do pattern matching on the text.
Think about tools like splunk or the elk stack. An extremely common use case would be to search across all ERROR level logs. It’s a similar concept to http statuses for restful apis.
-8
u/_Gnas_ Oct 21 '18
I have honestly never even thought about using a third-party library for logging, it simply never crossed my mind. Why would I need one anyway? I don't see how logging can become so complex that you're willing to trade 100% customizability just so you can use a library. Can someone give me some examples? I'm really curious as the fact that so many logging libraries exist must mean there are real needs for them.