]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
crimson/osd: reset logger before exit 46522/head
authorKefu Chai <tchaikov@gmail.com>
Sun, 5 Jun 2022 10:30:28 +0000 (18:30 +0800)
committerKefu Chai <tchaikov@gmail.com>
Sun, 5 Jun 2022 10:36:03 +0000 (18:36 +0800)
commit66c923d70354415cd1746c4f57cf31f3d55cc1bd
tree65b8c4ccf78b4a7cee3a8247f2e969bda9ffe135
parent2a2340d9d1ee62bde9e64017e9ea897429e40526
crimson/osd: reset logger before exit

* extract the code to set logging fstream into a dedicated function
* do not reset logging until the end of the seastar application.

before this change, `reset_logger` is created in the
`if (auto log_file = local_conf()->log_file; !log_file.empty())` branch,
so its life cycle ends when the `if` block ends. in other words,
the cerr fstream is used for logging after the `if` block ends.
this is not the expected behavior.

after this changge, `reset_logger` is created out of the `if` block.
so we won't reset the logger back to `cerr` until the lambda passed to
`seastar::async()` exits.

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
src/crimson/osd/main.cc