3 ms·
It’s worth noting that log4j does a lot more than, say, JavaScript’s console.log function. It’s dynamically configurable, supports a wide range of output format
by pimlottc 5y ago
It’s worth noting that log4j does a lot more than, say, JavaScript’s console.log function. It’s dynamically configurable, supports a wide range of output formats and destinations, easily filterable, and highly optimized to reduce performance impact (in part through delayed evaluation and multi-threading).
Rolling your own logging library to reimplement it is not trivial, even if you ignore the more esoteric output formats.
Sure, in retrospect they went too far with some of the dynamic logging features in log4j2, but it is no exaggeration to say that log4j revolutionized logging in the Java world when it first came out, and heavily shaped later solutions like logback and java.util.logging.
- TedDoesntTalk 5y ago> wide range of output formats Not to mention a wide range of destinations, too. Want to log to a database table? You’re covered. What about log messages to a chat server (xmpp, slack) or email but only fatal errors? You’re covered. Now roll your own logging system that supports those destinations safely and get back to me to do pen testing. I bet we’ll find some vulns in your code.
- tekknik 5y agoThis is the job of a log collector, not a log producer/library. The logging library itself should have no mechanism for shipping files anywhere except a file / stdout / stderr.
- ashtonkem 5y agoHindsight bias. Keep in mind that Log4j is older than most log aggregators by a solid decade. This is a solid reason to not use log4j going forward, but an ahistoric charge against it in the era when it was first written and adopted. Most of us have log4j in our system because it's used by some various dependency of one type or another, and up until now it has generally just worked.
- marcosdumay 5y agoYeah, doing so much more is a bug, not a feature. > It’s dynamically configurable It's a logging library. You don't reconfigure logging, you just make another logger and use it. And by the way, you take the configurations from your global configuration system, "dynamic configurable" is a feature of the configuration system, not of the logging. > supports a wide range of output formats and destinations Yeah, like network aware templates. (But the destinations are a feature, multiple destinations are one of the few things a logging library should support.) Despite what people claim, the Java culture of loving complexity never did go away.
- ashtonkem 5y ago> It's a logging library. You don't reconfigure logging, you just make another logger and use it. Prior company had a shared plugin that let you turn up the logging for a given logger remotely for 30 minutes (it self reset). Extremely helpful for incident debugging. Now we can have an interesting discussion about whether that capability is worth the complexity, but that’s a very different discussion than unilaterally declaring that other people’s use cases just don’t exist. > Despite what people claim, the Java culture of loving complexity never did go away. Do you develop in Java? Because I do, and your takes don’t match my daily experience one bit. My experience going from Spring 3 to Spring Boot 2 is in fact one of reducing complexity (goodbye XML bean configuration!) and to more “it just works” situations than before.
- marcosdumay 5y ago> Prior company had a shared plugin that let you turn up the logging for a given logger remotely for 30 minutes (it self reset). And you really believe this should be a feature of you logging library, and not of you configuration system?
- lazide 5y agoHow is your logging system going to get that new configuration without restarting if it doesn’t support dynamic reconfiguration?