New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom Formatter for airlift Log-manager used by presto #768
Comments
Do you have a specific format in mind? We’d prefer to have an option to logging in a standard JSON format rather than making it completely configurable. |
Yes for JSON format. How ever Id like the flexibility in mapping some fields in the record to standard fields which have been defined in Kibana and have indexes built on it. |
Can you give a specific example of what you’d like a log message to look like? |
Example : Would be nice if users can add their custom Formatter & just define it as a config like: log.custom-formatter=org.formmater.JsonFormatter We should be able to add org.formmater.JsonFormatter classpath, so that Airlift can load it and inject it as the Formatter to be used in the OutputstreamHandler |
We have a similar stack and would very much appreciate this feature as well. |
We stumbled across the logging in Trino today as well. Before we do any more work on this I was wondering how open you would be to switch from JUL to SLF4J in Airlift? It would not mean (m)any new dependencies because everything is already included. We could work on a Pull Request for this but would only do so if there is consensus that this could be accepted. I just went through all the libs (granted, in Trino) and wrote down where they come from and what they are. Posting it here mostly for my own reference. Airlift: Log4J2: SLF4J: SLF4J Binding: SLF4J Bridges: Logback: |
We don't use SLF4J in Trino because of class loaders. If plugins log via JUL, then everything just works. If they use SLF4J, then the plugin has to bridge to JUL, or we would need to add SLF4J to the plugin SPI, and that's problematic for a variety of reasons. We recently added a JSON logging format:
There is an optional annotations file which will be included as an
Finally, you can use a TCP destination for logging:
Note that both the logging configuration properties and the annotations file properties support the environment variable replacement that is described here, so you could do this:
|
Thanks for the detailed response. Apache NiFi is also based on a plugin architecture and they made a different decision. They have a As I said: I do understand your decision, it's a valid one. |
Thanks for the pointer. We considered adding our own logging interface (and already use Airlift Logger directly in Trino), but using JUL didn't require changing existing code or writing new logging bridges. Making logging completely pluggable has never been a goal for Trino, so I'd prefer to focus on the underlying problem you're trying to solve. What's your goal with customized logging? If you change the Trino |
Our goal is mostly consistency. All other Java tools we use (HBase, NiFi, Spark, Kafka....) are easily configurable to emit the exact same logging format. Trino is the only outlier which requires special handling as it uses "non-standard" logging. I put it into quotes as I do realize that you're using the only logging implementation that actually comes out of the box ;-) It's not a huge deal, we just found this issue and thought we'd inquire. We did play around with JUL-to-SLF4J but that wouldn't work 100%. It would always emit a "header" anyway (we didn't dig too deep) and then our properly formatted log message - and that again would require special handling. Now we're using the JSON format instead. Thank you for your answers, that already helps us. There is nothing that needs to be done here as far as we're concerned. I would suggest to leave this issue open to collect feedback from others. |
maybe it's something else in your case, but I had this issue with "special header + my message" too, which broke our logs. I found out that airlift does a global stdin redirect (which was a very big WTF moment for me, TBH... maybe there are good reasons), so that all output is processed by the logging system (so then something like |
For ingesting logs into Kibana , would like presto logs to be spit out in a JSON format. User should be able to extend java.util.logging.Formatter with a custom implementation & configure Airlift to use this custom class instead of the StaticFormatter.
The text was updated successfully, but these errors were encountered: