4 ms·
I don't use java and have never touched log4j, but structured logs are utterly fantastic and combined with an appropriate log server are far more useful than pl
by markmark 5y ago
I don't use java and have never touched log4j, but structured logs are utterly fantastic and combined with an appropriate log server are far more useful than plain text.
- lmm 5y agoStructured logging is great, but it's vital to keep them structured all the way through. Having an API where you pass a string and then something on the other side tries to parse that string back into structured data is a recipe for disaster.
- throw_m239339 5y agoThere is a difference between structured log and something that interprets these logs to create shells down the stack, inside a log library... Nobody is questioning the benefits of structured logs here. The log library itself shouldn't be interpreting these logs. It's like a HTTP framework... triggering a printer, why the hell would it be doing that by default? Seems to me that Log4j is doing to many things, including things it shouldn't be concerned with, as a log library.
- markmark 5y ago> Nobody is questioning the benefits of structured logs here. The guy I replied to was literally saying we should only log plain text and that doing anything more complicated is "emblematic of the crisis the industry is in".
- jrockway 5y agoI like structured logging but structured logging takes you away from a domain-specific language. Instead of log.Infof("fooed the bar: %v, baz=%v", msg, baz), you'd be writing log.Info("fooed the bar", zap.String("msg", msg), zap.Int("baz", baz)). The attack surface is pretty low here, even though you're doing more than just printing to a file. There is no code injection because there is no programming language going on behind the scenes. (Of course, nothing is preventing you from writing a formatting function that compiles and runs a binary built from the log message. So you aren't intrinsically safe from stupid stuff.)
- xorcist 5y agoParsing java logs isn't fun. Lots of libraries do their own mini-formats, suddenly multi-line stacktraces appear.