log: open journal when cli program run in a service unit

Previously, cli programs like networkctl always use console for logging.
This commit is contained in:
Yu Watanabe 2020-12-09 01:49:13 +09:00
parent db987463fe
commit 13ee939784
1 changed files with 3 additions and 1 deletions

View File

@ -1484,7 +1484,9 @@ void log_setup_service(void) {
void log_setup_cli(void) {
/* Sets up logging the way it is most appropriate for running a program as a CLI utility. */
log_show_color(true);
log_set_target(LOG_TARGET_AUTO);
log_parse_environment_cli();
(void) log_open();
if (log_on_console() && show_color < 0)
log_show_color(true);
}