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

[fix] #4030, #4063, #4064, #4079: re-architect logger and dynamic configuration #4100

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
64415e8
[fix] #4063: update configuration endpoints
0x009922 Nov 23, 2023
b430211
[refactor] #4063: use DTO naming
0x009922 Nov 23, 2023
8609d37
[refactor]: remove `Result<bool>`
0x009922 Nov 23, 2023
b7ea9e7
[test]: fix config tests (linked #4079)
0x009922 Nov 24, 2023
45b563f
[refactor]: introduce logger and config actors
0x009922 Nov 30, 2023
4374aad
[refactor]: rename `substrate` to `regular`
0x009922 Nov 30, 2023
e6b899b
Apply suggestions from code review
0x009922 Dec 4, 2023
1fceabc
[chore]: restore `.gitignore`
0x009922 Dec 4, 2023
58972cb
[refactor]: chores
0x009922 Dec 4, 2023
758394b
[refactor]: stronger types at telemetry starts
0x009922 Dec 4, 2023
0458d1e
[docs]: clarify for `Channel::Future`
0x009922 Dec 4, 2023
552306e
[test]: fix simple tests
0x009922 Dec 5, 2023
aa97d39
[test]: fix config endpoints test
0x009922 Dec 5, 2023
aa20fe7
[refactor]: lints
0x009922 Dec 5, 2023
6adcf86
[refactor]: fire-and-forget & loose coupling
0x009922 Dec 6, 2023
503c1d4
[refactor]: lints
0x009922 Dec 6, 2023
6610934
[docs]: regenerate config reference
0x009922 Dec 6, 2023
4921478
[docs]: regenerate references again
0x009922 Dec 6, 2023
334eb2a
[fix]: revert `String` in Kura, update `test_env.py`
0x009922 Dec 6, 2023
15fa1b2
[fix]: update usages of `block_store_path`
0x009922 Dec 6, 2023
5ccc9ed
[docs]: update PathBuf to String
0x009922 Dec 6, 2023
9fe9387
[fix]: return 202 ACCEPTED
0x009922 Dec 6, 2023
c17466f
[docs]: update logger usage guide
0x009922 Dec 6, 2023
f3d5f20
[refactor]: use `displaydoc`
0x009922 Dec 7, 2023
ff737b7
[chore]: redundant doccomment
0x009922 Dec 7, 2023
23bd7e6
[refactor]: remove redundant yield
0x009922 Dec 7, 2023
4c9bab4
[refactor]: remove excessive const generic
0x009922 Dec 12, 2023
65af92b
[refactor]: remove excessive method
0x009922 Dec 12, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ Follow these commit guidelines:

<details> <summary> Expand to learn how to change the log level or write logs to a JSON.</summary>

If one of your tests is failing, you may want to decrease the maximum logging level. By default, Iroha only logs `INFO` level messages, but retains the ability to produce both `DEBUG` and `TRACE` level logs. This setting can be changed either using the `MAX_LOG_LEVEL` environment variable for code-based tests, or using the `/configuration` endpoint on one of the peers in a deployed network.
If one of your tests is failing, you may want to decrease the maximum logging level. By default, Iroha only logs `INFO` level messages, but retains the ability to produce both `DEBUG` and `TRACE` level logs. This setting can be changed either using the `LOG_LEVEL` environment variable for code-based tests, or using the `/configuration` endpoint on one of the peers in a deployed network.

While logs printed in the `stdout` are sufficient, you may find it more convenient to produce `json`-formatted logs into a separate file and parse them using either [node-bunyan](https://www.npmjs.com/package/bunyan) or [rust-bunyan](https://crates.io/crates/bunyan).

Expand All @@ -251,16 +251,16 @@ In this case you should compile iroha with support of tokio console like that:
RUSTFLAGS="--cfg tokio_unstable" cargo build --features tokio-console
```

Port for tokio console can by configured through `TOKIO_CONSOLE_ADDR` configuration parameter (or environment variable).
Using tokio console require log level to be `TRACE`, can be enabled through configuration parameter or environment variable `MAX_LOG_LEVEL`.
Port for tokio console can by configured through `LOG_TOKIO_CONSOLE_ADDR` configuration parameter (or environment variable).
Using tokio console require log level to be `TRACE`, can be enabled through configuration parameter or environment variable `LOG_LEVEL`.

Example of running iroha with tokio console support using `scripts/test_env.sh`:

```bash
# 1. Compile iroha
RUSTFLAGS="--cfg tokio_unstable" cargo build --features tokio-console
# 2. Run iroha with TRACE log level
MAX_LOG_LEVEL=TRACE ./scripts/test_env.sh setup
LOG_LEVEL=TRACE ./scripts/test_env.sh setup
# 3. Access iroha. Peers will be available on ports 5555, 5556, ...
tokio-console http://127.0.0.1:5555
```
Expand Down
43 changes: 9 additions & 34 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 4 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ For a list of all endpoints, available operations, and ways to customize them wi

By default, Iroha provides logs in a human-readable format and prints them out to `stdout`.

The logging level can be changed either via a [configuration option](./docs/source/references/config.md#loggermax_log_level) or at run-time using the `configuration` endpoint.
The logging level can be changed either via the [`logger.level` configuration parameter](./docs/source/references/config.md#loggerlevel) or at run-time using the `configuration` endpoint.

<details><summary>Example: changing log level</summary>

Expand All @@ -178,17 +178,13 @@ For example, if your Iroha instance is running at `127.0.0.1:8080` and you want
curl -X POST \
-H 'content-type: application/json' \
http://127.0.0.1:8080/configuration \
-d '{"LogLevel": "DEBUG"}' -i
-d '{"logger": {"level": "DEBUG"}}' -i
```
</details>

#### JSON Logging Mode
The log format might be configured via the [`logger.format` configuration parameter](./docs/source/references/config.md#loggerformat). Possible values are: `full` (default), `compact`, `pretty`, and `json`.

Additionally, Iroha supports a JSON logging mode.

To enable it, provide the [logging file](./docs/source/references/config.md#loggerlog_file_path) to store the logs in. On UNIX, you can also specify `/dev/stdout` or `/dev/stderr` if you prefer to pipe the output to [`bunyan`](https://www.npmjs.com/package/bunyan).

[Log rotation](https://www.commandlinux.com/man-page/man5/logrotate.conf.5.html) is the responsibility of the peer administrator.
Output goes to `/dev/stdout`. Piping to files or [log rotation](https://www.commandlinux.com/man-page/man5/logrotate.conf.5.html) is the responsibility of the peer administrator.

### Monitoring

Expand Down
Loading
Loading