Log which thread a message came from
Former-commit-id: bc1eccb66d3302d6c99588fb4a5a879e1ef243b1
This commit is contained in:
parent
1b9ef774da
commit
833f5b39f4
@ -1037,6 +1037,7 @@ struct redisCommand redisCommandTable[] = {
|
|||||||
/* We use a private localtime implementation which is fork-safe. The logging
|
/* We use a private localtime implementation which is fork-safe. The logging
|
||||||
* function of Redis may be called from other threads. */
|
* function of Redis may be called from other threads. */
|
||||||
extern "C" void nolocks_localtime(struct tm *tmp, time_t t, time_t tz, int dst);
|
extern "C" void nolocks_localtime(struct tm *tmp, time_t t, time_t tz, int dst);
|
||||||
|
extern "C" pid_t gettid();
|
||||||
|
|
||||||
/* Low level logging. To use only for very big messages, otherwise
|
/* Low level logging. To use only for very big messages, otherwise
|
||||||
* serverLog() is to prefer. */
|
* serverLog() is to prefer. */
|
||||||
@ -1074,8 +1075,8 @@ void serverLogRaw(int level, const char *msg) {
|
|||||||
} else {
|
} else {
|
||||||
role_char = (listLength(g_pserver->masters) ? 'S':'M'); /* Slave or Master. */
|
role_char = (listLength(g_pserver->masters) ? 'S':'M'); /* Slave or Master. */
|
||||||
}
|
}
|
||||||
fprintf(fp,"%d:%c %s %c %s\n",
|
fprintf(fp,"%d:%d:%c %s %c %s\n",
|
||||||
(int)getpid(),role_char, buf,c[level],msg);
|
(int)getpid(),(int)gettid(),role_char, buf,c[level],msg);
|
||||||
}
|
}
|
||||||
fflush(fp);
|
fflush(fp);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user