Skip to content
This repository has been archived by the owner on Sep 28, 2021. It is now read-only.

Investigate log verbosity and suggest a solution #45

Open
sublibra opened this issue Sep 21, 2018 · 4 comments
Open

Investigate log verbosity and suggest a solution #45

sublibra opened this issue Sep 21, 2018 · 4 comments
Labels
enhancement New feature or request
Projects

Comments

@sublibra
Copy link
Collaborator

Investigate how we can balance log output from different tools against cluttering the cli output.

@sublibra sublibra created this issue from a note in Qlik Core (Backlog) Sep 21, 2018
@peol
Copy link

peol commented Sep 26, 2018

Logging

This is a suggestion how we should implement logging in command line tools.

Note that the commands and their output here might be fictional.

Configuration

We should be using our service logging level conventions as a base, using the same terminology as well as their definitions:
https://core.qlik.com/conventions/logging/#logging-level-definitions

One additional level could be added if we seem fit: SILENT.

The numeric mapping would be:

Level Numeric
TRACE 6
DEBUG 5
INFO 4 (default)
WARN 3
ERROR 2
FATAL 1
SILENT 0
corectl --log-level 6 reload --app foo.qvf
LOG_LEVEL=TRACE corectl --app foo.qvf

The environment variable is useful in e.g. Circle CI to avoid modifying scripts that already runs corectl commands.

Output

The output should, at minimum, be designed for humans. This means plain english and no too cryptic log formats.

In addition, it would be useful to support logging in different formats:

Human readable

corectl reload --app foo.qvf
[06:34:35] WARN: No --app defined, will use an session app instead.
[06:34:35] INFO: Reload started.
[06:34:38] INFO: Reload successful.

JSON

This format could (with benefit) use the logging conventions JSON output, but perhaps defined as an JSON array.

corectl reload --app foo.qvf
[
  {
    "timestamp": "2018-09-27T06:34:35.455Z",
    "logseverity": "WARN",
    "message": "No --app defined, will use an session app instead."
  },
  {
    "timestamp": "2018-09-27T06:34:35.715Z",
    "logseverity": "INFO",
    "message": "Reload started."
  },
  {
    "timestamp": "2018-09-27T06:34:38.119Z",
    "logseverity": "INFO",
    "message": "Reload successful."
  }
]

@sublibra sublibra added the question Further information is requested label Oct 2, 2018
@peol peol added v1 Scope for v1 and removed question Further information is requested labels Jan 25, 2019
@wennmo wennmo self-assigned this Mar 6, 2019
@wennmo
Copy link
Member

wennmo commented Mar 8, 2019

I have looked into adding a logging framework in corectl for logging in either plain text and json.

Since we are aiming for being able to customize the output e.g. log keys, format of timestamps and log levels there are atleast two suitable options:

Switching to using either of these framework for logging standard messages (INFO, DEBUG, FATAL etc.) or json traffic from our modules seems doable in a small timeframe. I have a branch where I have started the work on using logrus here.

As I see it there is two bigger tasks that needs to be resolved/discussed before we choose either of these options:

  • How should we handle Table printouts for e.g. an app list in plain text. Should this be printed direcly to stdout, through the logger or be removed? Passing it through the logger seems quite tricky with either of the options above.
  • Currently we are using golden files for integration tests which means that we assert on the printouts from the tool. With a logger adding timestamps this approach can no longer be used, unless we make it the timestamp optional on e.g. a test env variable. We can also change all the test cases to only assert on specific strings in the output, but that will lead to less verification.

@wennmo
Copy link
Member

wennmo commented Mar 19, 2019

Removing the v1 label on this issue since it is no longer in the scope of the first release.

@wennmo wennmo removed the v1 Scope for v1 label Mar 19, 2019
@wennmo wennmo removed their assignment Mar 22, 2019
@glooms glooms added the enhancement New feature or request label Jul 23, 2019
@glooms
Copy link
Contributor

glooms commented Jul 23, 2019

I think we should revisit this issue!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
No open projects
Qlik Core
  
Backlog
Development

No branches or pull requests

4 participants