Add date/timestamp information to memcached log

20 views
Skip to first unread message

Xuesen Liang

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

In this PR https://github.com/memcached/memcached/pull/971, date/timestamp information is added to memcached log.

Before:

$ ./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


After:

$ ./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.
Thanks~

dormando

unread,
Dec 29, 2022, 3:41:32 AM12/29/22
to memc...@googlegroups.com
Hey,

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.

-Dormando

On Dec 29, 2022, at 12:24 AM, Xuesen Liang <liang...@gmail.com> 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 memcached+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/memcached/805a10c5-8dfe-4c81-baa8-93be366a9824n%40googlegroups.com.

Xuesen Liang

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