Skip to content
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

How to specify ZK instance log configuration #252

Closed
dalbani opened this issue Oct 5, 2020 · 10 comments
Closed

How to specify ZK instance log configuration #252

dalbani opened this issue Oct 5, 2020 · 10 comments

Comments

@dalbani
Copy link

dalbani commented Oct 5, 2020

The ZK operator generates a ConfigMap containing several items:

  • zoo.cfg
  • log4j.properties
  • log4j-quiet.properties
  • env.sh

And these files get copied to the /data/conf directory which is used by ZooKeeper if I'm not mistaken.
I would like to configure the ZooKeeper instances to use log4j-quiet.properties instead of log4j.properties.
How can I do that? Given the fact the ConfigMap gets overwritten at the reconciliation phase by the way.

@anishakj
Copy link
Contributor

Are you changing the log configurations at the time of fresh installation or later?

@dalbani
Copy link
Author

dalbani commented Oct 19, 2020

Well, I don't think it makes much of a difference AFAIK.
Because the function that creates the ConfigMap produces the same result when the ConfigMap gets created or overwritten: https://github.com/pravega/zookeeper-operator/blob/master/pkg/controller/zookeepercluster/zookeepercluster_controller.go#L447.
So I don't see how I can tweak the ConfigMap at any point.

@anishakj
Copy link
Contributor

Yes you are correct. At the time of restart also, we are copying the log4j-quiet.proerties. https://github.com/pravega/zookeeper-operator/blob/master/docker/bin/zookeeperStart.sh#L159

@dalbani
Copy link
Author

dalbani commented Oct 19, 2020

If only I could tell ZooKeeper to use log4j-quiet.properties instead of log4j.properties, that would be enough for me.
But I haven't been able to find a way to do it. For example via an environment variable.
Would you know another way by any chance?

@anishakj
Copy link
Contributor

anishakj commented Oct 23, 2020

@dalbani If i understood correctly, requirement to set log level to ERROR, rather than INFO. But currently log4j.appender.CONSOLE.Threshold is set as INFO by default. If we want to make this configurable, we have to introduce new variable in spec, and set the log4j.properties accordingly.

@anishakj
Copy link
Contributor

anishakj commented Nov 4, 2020

@dalbani Could you please confirm if above is the requirement

@dalbani
Copy link
Author

dalbani commented Nov 4, 2020

@anishakj
Well, being able to provide one's own log4j.properties definition would probably be best, I suppose.
But being able to set the global log level is also fine for me.
Actually, I was wondering if it's not already possible via:

apiVersion: zookeeper.pravega.io/v1beta1
kind: ZookeeperCluster
spec:
  ...
  pod:
    ...
    env:
      - name: ZOO_LOG4J_PROP
        value: 'ERROR,CONSOLE'

Based on the code at https://github.com/apache/zookeeper/blob/master/bin/zkEnv.sh#L73.

(In my case, as a ZooKeeper user via the Solr operator, I'd still have to figure out how to pass this env information from the SolrCloud CR definition to the ZookeeperCluster CR definition. But that's another discussion.)

@anishakj
Copy link
Contributor

anishakj commented Nov 4, 2020

@anishakj
Well, being able to provide one's own log4j.properties definition would probably be best, I suppose.
But being able to set the global log level is also fine for me.
Actually, I was wondering if it's not already possible via:

apiVersion: zookeeper.pravega.io/v1beta1
kind: ZookeeperCluster
spec:
  ...
  pod:
    ...
    env:
      - name: ZOO_LOG4J_PROP
        value: 'ERROR,CONSOLE'

Based on the code at https://github.com/apache/zookeeper/blob/master/bin/zkEnv.sh#L73.

(In my case, as a ZooKeeper user via the Solr operator, I'd still have to figure out how to pass this env information from the SolrCloud CR definition to the ZookeeperCluster CR definition. But that's another discussion.)

We can add ENV to mention log level. But not sure if log level is mentioned via log4j-properties as well as ENV which one will take preference. Currently we are using log4j-properties and is hardcoded to INFO.

@anishakj
Copy link
Contributor

anishakj commented Nov 4, 2020

By setting env in https://github.com/pravega/zookeeper-operator/blob/master/charts/zookeeper/values.yaml#L19 , logs are coming correctly for the pods according to the loge level set. Can we close this issue in that case?

@dalbani
Copy link
Author

dalbani commented Nov 4, 2020

Yes, that's fine. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants