[
https://issues.apache.org/jira/browse/ZOOKEEPER-4757?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17774138#comment-17774138
]
Christopher Tubbs edited comment on ZOOKEEPER-4757 at 10/11/23 4:49 PM:
------------------------------------------------------------------------
ZooKeeper has taken steps to use SLF4J as its logging framework, and has chosen
to use logback as the default runtime implementation, and ships with a logback
configuration file as a reference implementation.
The current status quo should suffice. I do not think that the ZooKeeper
project should take additional steps to try to accommodate specific
customizations to the logging, since the whole point of using SLF4J is that it
is completely pluggable and configurable by users.
If a user needs a specific customization, they just need to:
1. Provide a user-supplied logback configuration rather than the default one
that ships, OR
2. Replace the slf4j logging runtime with a different logging runtime, such as
log4j or another of their choosing, and supply a config file appropriate for
that runtime
It should not be necessary for ZooKeeper itself to do anything to support this,
since it is already supported by the choice to use a highly-customizable
logging framework so users can customize according to their hearts' desire.
I also strongly advise against adding logging customizations to the scripts via
environment variables that cause people to be reliant on the baked-in scripts,
rather than using the pluggable mechanisms provided by SLF4J, because that just
adds confusion. The only real customization users need to set to support any
logging they want is {{CLASSPATH}} and some kind of JAVA OPTS variable to
modify the Java command line options
(https://stackoverflow.com/q/52986487/196405). There's already a "right" way to
customize logging. Adding more ways to do it is just going to bloat the scripts
with unneeded features that create confusion and make it so users are dependent
on particular "convenience" customizations, rather than on doing it the right
way using the pluggable mechanism.
Logging is hard enough, let's not make the situation worse by adding more
complexity for a one-off use case.
was (Author: ctubbsii):
ZooKeeper has taken steps to use SLF4J as its logging framework, and has chosen
to use logback as the default runtime implementation, and ships with a logback
configuration file as a reference implementation.
The current status quo should suffice. I do not think that the ZooKeeper
project should take additional steps to try to accommodate specific
customizations to the logging, since the whole point of using SLF4J is that it
is completely pluggable and configurable by users.
If a user needs a specific customization, they just need to:
1. Provide a user-supplied logback configuration rather than the default one
that ships, OR
2. Replace the slf4j logging runtime with a different logging runtime, such as
log4j or another of their choosing, and supply a config file appropriate for
that runtime
It should not be necessary for ZooKeeper itself to do anything to support this,
since it is already supported by the choice to use a highly-customizable
logging framework so users can customize according to their hearts' desire.
I also strongly advise against adding logging customizations to the scripts via
environment variables that cause people to be reliant on the baked-in scripts,
rather than using the pluggable mechanisms provided by SLF4J. The only real
customization users need to set to support any logging they want is
{{CLASSPATH}} and some kind of JAVA OPTS variable to modify the Java command
line options (https://stackoverflow.com/q/52986487/196405)
> Support JSON format logging
> ---------------------------
>
> Key: ZOOKEEPER-4757
> URL: https://issues.apache.org/jira/browse/ZOOKEEPER-4757
> Project: ZooKeeper
> Issue Type: Improvement
> Reporter: Jan Høydahl
> Priority: Major
> Labels: pull-request-available
> Time Spent: 1h 50m
> Remaining Estimate: 0h
>
> More and more enterprise users request structured JSON format logging for
> their applications. This removes the need for configuring custom log line
> parsers for every application when collecting logs centrally.
> Zookeeper has flexible logging through Slf4j and Logback, for which there are
> several ways to achieve JSON logging. But for end users (such as helm chart
> user) it is very difficult to achieve. It should ideally be as simple as a
> configuration option.
> OpenTelemetry is a CNCF project that has become the defacto standard for
> metrics and traces collection. They also cover logging, and they recently
> [standardized on ECS JSON
> format|https://opentelemetry.io/blog/2023/ecs-otel-semconv-convergence/] as
> their log schema for OTEL-logging. Although there are other JSON formats in
> use, a pragmatic option for zookeeper is to only support ECS.
> Proposed way to enable JSON logging:
> {code:java}
> export ZOO_LOG_FORMAT=json
> bin/zkServer.sh start-foreground{code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)