Browse Source

ckdb - log all incoming to the rotating log

master
kanoi 11 years ago
parent
commit
cffeb9db79
  1. 8
      src/ckdb.c

8
src/ckdb.c

@ -868,6 +868,9 @@ static K_TREE *userstats_root;
static K_LIST *userstats_list; static K_LIST *userstats_list;
static K_STORE *userstats_store; static K_STORE *userstats_store;
static char logname[512];
#define LOGFILE(_msg) rotating_log(logname, _msg)
static void setnow(tv_t *now) static void setnow(tv_t *now)
{ {
ts_t spec; ts_t spec;
@ -3995,6 +3998,8 @@ static void *listener(void *arg)
else else
LOGWARNING("Empty message in listener"); LOGWARNING("Empty message in listener");
} else { } else {
// Log everything we get (for now)
LOGFILE(buf);
cmdnum = breakdown(buf, &which_cmds, cmd, id); cmdnum = breakdown(buf, &which_cmds, cmd, id);
switch (cmdnum) { switch (cmdnum) {
case CMD_REPLY: case CMD_REPLY:
@ -4145,6 +4150,9 @@ int main(int argc, char **argv)
quit(1, "Failed to open log file %s", buf); quit(1, "Failed to open log file %s", buf);
ckp.logfd = fileno(ckp.logfp); ckp.logfd = fileno(ckp.logfp);
snprintf(logname, sizeof(logname), "%s%s",
ckp.logdir, ckp.ckdb_name);
ckp.main.ckp = &ckp; ckp.main.ckp = &ckp;
ckp.main.processname = strdup("main"); ckp.main.processname = strdup("main");
ckp.main.sockname = strdup("listener"); ckp.main.sockname = strdup("listener");

Loading…
Cancel
Save