File: logging.md

package info (click to toggle)
zabbix-cli 3.5.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,860 kB
  • sloc: python: 18,557; makefile: 3
file content (58 lines) | stat: -rw-r--r-- 1,453 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# Logging

The application supports logging to a file or directly to the terminal. By default, file logging is enabled and set to the `ERROR` level.

## Enable/disable logging

Logging is enabled by default. To disable logging, set the `enabled` option to `false` in the configuration file:

```toml
[logging]
enabled = true
```

## Levels

The application only logs messages with a level equal to or higher than the configured level. By default, the level is set to `ERROR`. The available levels are:

- `DEBUG`
- `INFO`
- `WARNING`
- `ERROR`
- `CRITICAL`

The level can be set in the configuration file:

```toml
[logging]
level = "DEBUG"
```

## Log file

The default location of the log file is a file named `zabbix-cli.log` in the application's logs directory.

The log file location can be changed in the configuration file:

```toml
[logging]
log_file = "/path/to/zabbix-cli.log"
```

The default logs directory can be opened with the command:

```bash
zabbix-cli open logs
```

## Log to terminal

!!! warning "Verbose output"
    Logging to the terminal can produce a lot of output, especially when the log level is set to `DEBUG`. Furthermore, some of the output messages may be shown twice, as they are printed once by the application and once by the logging library.

If the `log_file` option is set to an empty string or an invalid file path, the application will log to the terminal instead of a file.

```toml
[logging]
log_file = ""
```