Add date/timestamp information to memcached log

Skip to first unread message

Xuesen Liang

Dec 29, 2022, 3:24:52 AM12/29/22
to memcached

In this PR, date/timestamp information is added to memcached log.


$ ./memcached -vv
 ... ... 
<17 server listening (auto-negotiate)
<18 server listening (auto-negotiate)
^CSignal handled: Interrupt: 2.
stopped assoc
asking workers to stop
asking background threads to stop
stopped lru crawler
stopped maintainer
stopped slab mover
stopped logger thread
stopped idle timeout thread
closing connections
<17 connection closed.
<18 connection closed.
reaping worker threads
all background threads stopped


$ ./memcached -vv
 ... ... 
2022-12-29_16:08:17,932431 <17 server listening (auto-negotiate)
2022-12-29_16:08:17,932629 <18 server listening (auto-negotiate)
2022-12-29_16:08:22,078384 <19 new auto-negotiating client connection
2022-12-29_16:08:32,304416 <19 connection closed.
^CSignal handled: Interrupt: 2.
2022-12-29_16:08:43,015118 stopped assoc
2022-12-29_16:08:43,015134 asking workers to stop
2022-12-29_16:08:43,015183 asking background threads to stop
2022-12-29_16:08:43,015209 stopped lru crawler
2022-12-29_16:08:43,407434 stopped maintainer
2022-12-29_16:08:43,407467 stopped slab mover
2022-12-29_16:08:43,407498 stopped logger thread
2022-12-29_16:08:43,407511 stopped idle timeout thread
2022-12-29_16:08:43,407519 closing connections
2022-12-29_16:08:43,407523 <17 connection closed.
2022-12-29_16:08:43,407543 <18 connection closed.
2022-12-29_16:08:43,407554 reaping worker threads
2022-12-29_16:08:43,407630 all background threads stopped

If this patch is ok, I will continue to replace other fprintf with time_fprintf.


Dec 29, 2022, 3:41:32 AM12/29/22

Thanks! We've had a few PR's/questions like this before and unfortunately I don't take them.

1) STDOUT/STDERR logs don't typically have timestamps, as they're usually put through syslog or similar systems which adds their own timestamp. Without options this would make memcached logs have double timestamps. if you're not using syslog/etc there are plenty of cli tools which add timestamps via piping.
2) I've been moving logging to the "watch" system, which does have timestamps when you're accessing it directly. It is supposed to get a stdout/stderr/syslog mode which would drop the timestamp from the output. I've not done this yet since the watch logs don't have parity with the original debug logs.
3) most of these logs are for debugging and don't make a ton of sense to be timed.


On Dec 29, 2022, at 12:24 AM, Xuesen Liang <> wrote:


You received this message because you are subscribed to the Google Groups "memcached" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit

Xuesen Liang

Dec 29, 2022, 4:05:33 AM12/29/22
to memcached
Got it. Thanks for your reply!
Reply all
Reply to author
0 new messages