5 ms·
What I miss in (almost?) all the logging framework is the concept of logging structured data types for easy machine parsing and analysis. All the logging packag
by wladimir 15y ago
What I miss in (almost?) all the logging framework is the concept of logging structured data types for easy machine parsing and analysis. All the logging packages are focused toward formatting and logging short text messages for humans to read.
This is nice initially, but with large volumes of logging you want to perform statistics (what errors / error codes are most common? which users make most use of a certain API call? etc). In which case it's kind of duplicate work to write formatters and parsers for every message type.
I know there is the "RFC5424 structured logging" standard but it's not really widely supported yet. So generally I end up dumping to some JSON-based format instead of using a logging toolkit.
Then again, I'm not up-to-date in Java logging. Please enlighten me if I'm overlooking something.
- ataggart 15y agoSLF4J and java.util.logging take string messages, but commons-logging and log4j take objects, so one could add custom appenders to handle non-string messages.
- mindcrime 15y agoIt's not Java specific, but there's some work out there on standards for logging. IBM rolled out this big thing called "CBE" for "Common Base Events"[1],[2] a few years ago, as part of their "Autonomic Computing" initiative. Eventually that somehow got all rolled up into one of the many WS-* specs, and become part of something called WSDM-WEF for "Web Services Distributed Management - Web Event Framework."[3],[4]. There's an OASIS spec[5] for this stuff, and an ASF project - "Muse"[6] - to provide a Java implementation. There are also classes to implement this stuff in the Eclipse Hyades[7] project. [1]: https://www.ibm.com/developerworks/wikis/display/CBEbestpractice/Common+Base+Event+Best+Practices https://www.ibm.com/developerworks/wikis/display/CBEbestprac... [2]: http://www.ibm.com/developerworks/autonomic/books/fpy0mst.htm#HDRAPPA http://www.ibm.com/developerworks/autonomic/books/fpy0mst.ht... [3]: http://en.wikipedia.org/wiki/Common_Base_Event http://en.wikipedia.org/wiki/Common_Base_Event [4]: http://en.wikipedia.org/wiki/Web_Services_Distributed_Management http://en.wikipedia.org/wiki/Web_Services_Distributed_Manage... [5]: http://www.oasis-open.org/committees/tc_home.php?wg_abbrev=wsdm http://www.oasis-open.org/committees/tc_home.php?wg_abbrev=w... [6]: http://ws.apache.org/muse/ http://ws.apache.org/muse/ [7]: http://archive.eclipse.org/tptp/4.0.0/javadoc/Platform/public/org/eclipse/hyades/logging/events/cbe/package-tree.html http://archive.eclipse.org/tptp/4.0.0/javadoc/Platform/publi...