From: Sage Weil Date: Tue, 9 Mar 2010 22:05:52 +0000 (-0800) Subject: mds: create mds.$id debug log symlink X-Git-Tag: v0.20~305 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=fe4f42bc29acac808ad29bd4d397dc08e2ea1229;p=ceph.git mds: create mds.$id debug log symlink ...in addition to the current mds$num --- diff --git a/src/common/debug.cc b/src/common/debug.cc index 34121096be20..097a980cf755 100644 --- a/src/common/debug.cc +++ b/src/common/debug.cc @@ -114,12 +114,19 @@ int _dout_rename_output_file() // after calling daemon() } int _dout_create_courtesy_output_symlink(const char *type, __s64 n) +{ + char name[20]; + snprintf(name, sizeof(name), "%s%lld", type, (unsigned long long)n); + return _dout_create_courtesy_output_symlink(name); +} + +int _dout_create_courtesy_output_symlink(const char *name) { if (g_conf.log_dir && !g_conf.log_to_stdout) { if (_dout_need_open) _dout_open_log(); - snprintf(_dout_symlink_path, sizeof(_dout_symlink_path), "%s/%s%lld", _dout_symlink_dir, type, (long long)n); + snprintf(_dout_symlink_path, sizeof(_dout_symlink_path), "%s/%s", _dout_symlink_dir, name); // rotate out old symlink int n = 0; diff --git a/src/common/debug.h b/src/common/debug.h index e748e9548b87..fbce4ce7998f 100644 --- a/src/common/debug.h +++ b/src/common/debug.h @@ -23,6 +23,7 @@ extern bool _dout_is_open; extern void _dout_open_log(); extern int _dout_rename_output_file(); // after calling daemon() extern int _dout_create_courtesy_output_symlink(const char *type, __s64 n); +extern int _dout_create_courtesy_output_symlink(const char *name); static inline void _dout_check_log() { _dout_lock.Lock(); diff --git a/src/mds/MDS.cc b/src/mds/MDS.cc index 2bdb416dfd34..550e101d27bb 100644 --- a/src/mds/MDS.cc +++ b/src/mds/MDS.cc @@ -396,6 +396,10 @@ int MDS::init() messenger->add_dispatcher_tail(this); messenger->add_dispatcher_head(&logclient); + char name[30]; + snprintf(name, sizeof(name), "mds.%s", g_conf.id); + _dout_create_courtesy_output_symlink(name); + // get monmap monc->set_messenger(messenger);