Skip to content

Commit

Permalink
mds: create mds.$id debug log symlink
Browse files Browse the repository at this point in the history
...in addition to the current mds$num
  • Loading branch information
liewegas committed Mar 9, 2010
1 parent 72e04c8 commit fe4f42b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/common/debug.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/common/debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
4 changes: 4 additions & 0 deletions src/mds/MDS.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit fe4f42b

Please sign in to comment.