diff --git a/src/core/config/mod.rs b/src/core/config/mod.rs index a3e11713..a829963d 100644 --- a/src/core/config/mod.rs +++ b/src/core/config/mod.rs @@ -888,6 +888,15 @@ pub struct Config { #[serde(default)] pub log_thread_ids: bool, + /// Redirects logging to standard error (stderr). The default is false for + /// stdout. For those using our systemd features the redirection to stderr + /// occurs as necessary and setting this option should not be required. We + /// offer this option for all other users who desire such redirection. + /// + /// default: false + #[serde(default)] + pub log_to_stderr: bool, + /// OpenID token expiration/TTL in seconds. /// /// These are the OpenID tokens that are primarily used for Matrix account diff --git a/src/core/log/console.rs b/src/core/log/console.rs index c91c0728..308895aa 100644 --- a/src/core/log/console.rs +++ b/src/core/log/console.rs @@ -28,13 +28,13 @@ pub struct ConsoleWriter { impl ConsoleWriter { #[must_use] - pub fn new(_config: &Config) -> Self { + pub fn new(config: &Config) -> Self { let journal_stream = get_journal_stream(); Self { stdout: io::stdout(), stderr: io::stderr(), _journal_stream: journal_stream.into(), - use_stderr: journal_stream.0 != 0, + use_stderr: journal_stream.0 != 0 || config.log_to_stderr, } } } diff --git a/tuwunel-example.toml b/tuwunel-example.toml index 8ef94ed7..1a0493ae 100644 --- a/tuwunel-example.toml +++ b/tuwunel-example.toml @@ -733,6 +733,13 @@ # #log_thread_ids = false +# Redirects logging to standard error (stderr). The default is false for +# stdout. For those using our systemd features the redirection to stderr +# occurs as necessary and setting this option should not be required. We +# offer this option for all other users who desire such redirection. +# +#log_to_stderr = false + # OpenID token expiration/TTL in seconds. # # These are the OpenID tokens that are primarily used for Matrix account