From e225c236e1375c26408da087396a5e3955003e17 Mon Sep 17 00:00:00 2001 From: feiniks <36756310+feiniks@users.noreply.github.com> Date: Mon, 13 Jan 2025 11:48:26 +0800 Subject: [PATCH] Print app name when SEAFILE_LOG_TO_STDOUT is true (#734) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: 杨赫然 --- common/log.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/common/log.c b/common/log.c index 163392f0..507b2cbd 100644 --- a/common/log.c +++ b/common/log.c @@ -161,12 +161,14 @@ seafile_log_init (const char *_logfile, const char *ccnet_debug_level_str, app_name = g_strdup (_app_name); const char *log_to_stdout_env = g_getenv("SEAFILE_LOG_TO_STDOUT"); - if (g_strcmp0(_logfile, "-") == 0 || g_strcmp0(log_to_stdout_env, "true") == 0) { + if (g_strcmp0(log_to_stdout_env, "true") == 0) { logfp = stdout; logfile = g_strdup (_logfile); log_to_stdout = TRUE; - } - else { + } else if (g_strcmp0(_logfile, "-") == 0) { + logfp = stdout; + logfile = g_strdup (_logfile); + } else { logfile = ccnet_expand_path(_logfile); if ((logfp = g_fopen (logfile, "a+")) == NULL) { seaf_message ("Failed to open file %s\n", logfile);