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

Use consistent logging style #362

Closed
nicolaferraro opened this issue Jan 23, 2019 · 2 comments
Closed

Use consistent logging style #362

nicolaferraro opened this issue Jan 23, 2019 · 2 comments
Assignees

Comments

@nicolaferraro
Copy link
Member

We used logrus in first implementation using operator-sdk 0.x, now the logging implementation has changed in controller-runtime and if you look at the logs you see two different styles, one belonging to logrus and the other (json style) for controller-runtime stuff.

We should use a consistent style.

@lburgazzoli
Copy link
Contributor

Agree

  • should we go for a complete structured logger ?
  • if yes, should we write our own wrapper for consistency ?
    • log.ForIntegration(...).Info|Infof|...
    • log.ForIntegrationContext(...).Info|Infof|...(...)
    • ...

@lburgazzoli lburgazzoli self-assigned this Jan 23, 2019
@lburgazzoli
Copy link
Contributor

I've been experimenting a little to wrap the logging primitive provided by the operator so the operator part looks like:

{"level":"info","ts":1548251222.2835329,"logger":"cmd","msg":"Go Version: go1.11"}
{"level":"info","ts":1548251222.2836378,"logger":"cmd","msg":"Go OS/Arch: linux/amd64"}
{"level":"info","ts":1548251222.2836797,"logger":"cmd","msg":"operator-sdk Version: v0.3.0"}
{"level":"info","ts":1548251222.2987003,"logger":"leader","msg":"Trying to become the leader."}
{"level":"info","ts":1548251222.2987378,"logger":"leader","msg":"Skipping leader election; not running in a cluster."}
{"level":"info","ts":1548251222.346715, "logger":"cmd","msg":"Registering Components."}
{"level":"info","ts":1548251222.3477561,"logger":"kubebuilder.controller","msg":"Starting EventSource","controller":"integration-controller","source":"kind source: /, Kind="}
{"level":"info","ts":1548251222.3479214,"logger":"kubebuilder.controller","msg":"Starting EventSource","controller":"integration-controller","source":"kind source: /, Kind="}
{"level":"info","ts":1548251222.3484404,"logger":"kubebuilder.controller","msg":"Starting EventSource","controller":"integrationcontext-controller","source":"kind source: /, Kind="}
{"level":"info","ts":1548251222.3486776,"logger":"kubebuilder.controller","msg":"Starting EventSource","controller":"integrationplatform-controller","source":"kind source: /, Kind="}
{"level":"info","ts":1548251222.3487132,"logger":"cmd","msg":"Starting the Cmd."}
{"level":"info","ts":1548251222.448883, "logger":"kubebuilder.controller","msg":"Starting Controller","controller":"integration-controller"}
{"level":"info","ts":1548251222.4488826,"logger":"kubebuilder.controller","msg":"Starting Controller","controller":"integrationplatform-controller"}
{"level":"info","ts":1548251222.4489074,"logger":"kubebuilder.controller","msg":"Starting Controller","controller":"integrationcontext-controller"}
{"level":"info","ts":1548251222.549115, "logger":"kubebuilder.controller","msg":"Starting workers","controller":"integration-controller","worker count":1}
{"level":"info","ts":1548251222.5491164,"logger":"kubebuilder.controller","msg":"Starting workers","controller":"integrationcontext-controller","worker count":1}
{"level":"info","ts":1548251222.5491395,"logger":"kubebuilder.controller","msg":"Starting workers","controller":"integrationplatform-controller","worker count":1}
{"level":"info","ts":1548251222.5492136,"logger":"camel-k.controller.integrationcontext","msg":"Reconciling IntegrationContext","request-namespace":"camel-k","request-name":"jvm"}
{"level":"info","ts":1548251222.5492213,"logger":"camel-k.controller.integrationplatform","msg":"Reconciling IntegrationPlatform","request-namespace":"camel-k","request-name":"camel-k"}
{"level":"info","ts":1548251222.5492449,"logger":"camel-k.controller.integrationcontext","msg":"Invoking action monitor","request-namespace":"camel-k","request-name":"jvm","type":"IntegrationContext","ns":"camel-k","name":"jvm"}
{"level":"info","ts":1548251226.9962876,"logger":"camel-k.controller.integration","msg":"Reconciling Integration","request-namespace":"camel-k","request-name":"hello"}
{"level":"info","ts":1548251226.9963143,"logger":"camel-k.controller.integration","msg":"Invoking action initialize","request-namespace":"camel-k","request-name":"hello","type":"Integration","ns":"camel-k","name":"hello"}
{"level":"info","ts":1548251227.004409, "logger":"camel-k.controller.integration","msg":"Reconciling Integration","request-namespace":"camel-k","request-name":"hello"}
{"level":"info","ts":1548251227.00443,  "logger":"camel-k.controller.integration","msg":"Invoking action build-context","request-namespace":"camel-k","request-name":"hello","type":"Integration","ns":"camel-k","name":"hello"}
{"level":"info","ts":1548251227.008996, "logger":"camel-k.controller.integration","msg":"Reconciling Integration","request-namespace":"camel-k","request-name":"hello"}
{"level":"info","ts":1548251227.009017, "logger":"camel-k.controller.integration","msg":"Invoking action deploy","request-namespace":"camel-k","request-name":"hello","type":"Integration","ns":"camel-k","name":"hello"}
{"level":"info","ts":1548251227.0411463,"logger":"camel-k.controller.integration","msg":"Reconciling Integration","request-namespace":"camel-k","request-name":"hello"}
{"level":"info","ts":1548251227.0411794,"logger":"camel-k.controller.integration","msg":"Invoking action monitor","request-namespace":"camel-k","request-name":"hello","type":"Integration","ns":"camel-k","name":"hello"}
{"level":"info","ts":1548251227.0475428,"logger":"camel-k.controller.integration","msg":"Reconciling Integration","request-namespace":"camel-k","request-name":"hello"}
{"level":"info","ts":1548251227.0475745,"logger":"camel-k.controller.integration","msg":"Invoking action monitor","request-namespace":"camel-k","request-name":"hello","type":"Integration","ns":"camel-k","name":"hello"}
{"level":"info","ts":1548251227.0584202,"logger":"camel-k.controller.integration","msg":"Reconciling Integration","request-namespace":"camel-k","request-name":"hello"}
{"level":"info","ts":1548251227.0585632,"logger":"camel-k.controller.integration","msg":"Invoking action monitor","request-namespace":"camel-k","request-name":"hello","type":"Integration","ns":"camel-k","name":"hello"}
{"level":"info","ts":1548251227.118853, "logger":"camel-k.controller.integration","msg":"Reconciling Integration","request-namespace":"camel-k","request-name":"hello"}
{"level":"info","ts":1548251227.1188924,"logger":"camel-k.controller.integration","msg":"Invoking action monitor","request-namespace":"camel-k","request-name":"hello","type":"Integration","ns":"camel-k","name":"hello"}
{"level":"info","ts":1548251228.299993, "logger":"camel-k.controller.integration","msg":"Reconciling Integration","request-namespace":"camel-k","request-name":"hello"}
{"level":"info","ts":1548251228.3000236,"logger":"camel-k.controller.integration","msg":"Invoking action monitor","request-namespace":"camel-k","request-name":"hello","type":"Integration","ns":"camel-k","name":"hello"}
{"level":"info","ts":1548251232.0046387,"logger":"camel-k.controller.integration","msg":"Reconciling Integration","request-namespace":"camel-k","request-name":"hello"}
{"level":"info","ts":1548251232.00472,  "logger":"camel-k.controller.integration","msg":"Invoking action monitor","request-namespace":"camel-k","request-name":"hello","type":"Integration","ns":"camel-k","name":"hello"}

lburgazzoli added a commit to lburgazzoli/apache-camel-k that referenced this issue Jan 25, 2019
lburgazzoli added a commit to lburgazzoli/apache-camel-k that referenced this issue Jan 25, 2019
ipolyzos pushed a commit to ipolyzos/camel-k that referenced this issue Jul 31, 2019
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