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

Log format #704

Merged
merged 7 commits into from
Oct 24, 2024
Merged

Log format #704

merged 7 commits into from
Oct 24, 2024

Conversation

feiniks
Copy link
Contributor

@feiniks feiniks commented Sep 23, 2024

No description provided.

common/log.c Outdated
@@ -59,12 +62,24 @@ seafile_log (const gchar *log_domain, GLogLevelFlags log_level,
if (log_level > seafile_log_level)
return;

if (log_to_stdout) {
fputs ("[seaf-server] ", logfp);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

应该在 seafile_log_init 函数增加一个参数(第一个参数),用于指定组件的名称,因为需要区分 seaf-server, seaf-fuse, controller 三个组件的日志的。还有 slow log 也有自己的日志名称。

@@ -202,6 +202,7 @@ start_seaf_server ()
"-l", logfile,
"-P", ctl->pidfile[PID_SERVER],
"-p", ctl->rpc_pipe_path,
"-f",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

controller 和 seaf-server 应该在检测到 SEAFILE_LOG_TO_STDOUT 这个环境变量之后,主动禁用 daemon mode。这里不应该直接禁用 daemon mode,因为会影响非 docker 部署的用户。docker 部署下,应该是不需要 daemon mode 的,因为容器会一直运行。

if (seafile_log_init (logfile, ccnet_debug_level_str,
seafile_debug_level_str) < 0) {
seafile_log_init ("-", ccnet_debug_level_str, seafile_debug_level_str);
seaf_error ("Failed to init log.\n");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

在 seafile_log_init 之前的日志,就用 printf 输出就行了,这些都是些参数错误,在生产环境是不会出现的,所以不重要。其他几个组件也不需要改这些日志的输出了。

"-r, --rm-deleted: remove garbaged repos\n"
"-R, --rm-fs: remove fs object\n"
"-D, --dry-run: report blocks that can be remove, but not remove them\n"
"-V, --verbose: verbose output messages\n");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gc 和 fsck 的 usage 日志不用改了。

"-l", logfile,
"-P", ctl->pidfile[PID_SERVER],
"-p", ctl->rpc_pipe_path,
"-f",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我之前的意思是,seaf-server, controller 这些会一直运行的程序,应该在检测到 SEAFILE_LOG_TO_STDOUT 之后,主动禁用掉 daemon mode,不理会输入的 -f 参数。不是在 controller 启动他们的时候通过 -f 参数控制。

@killing killing merged commit 6af96fe into master Oct 24, 2024
6 checks passed
@killing killing deleted the log_format branch October 24, 2024 02:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants