memcached: Including timestamps in Memcached error logs

Hi,

We found that memcached logs is done via fprintf() and perror() and each line of log doesn’t have a timestamp. This is an inconvenience for operators when troubleshooting. So questions here are:

  1. Do we plan to add timestamps to memcached logs in the near future? i.e. use a better shaped “logger” instead of fprintf / perror or with some other mechanism?

  2. Has anyone asked for this before? If so, what was the reason we didn’t do it?

p.s. If we are okay with fixing this, I can help with the implementation.

Thanks

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 2
  • Comments: 21 (15 by maintainers)

Most upvoted comments

Well to summarize:

  • There’s a new logging system we need to migrate to, and deprecate/remove/debug-compile-gate useless log lines. The system has timestamps as part of its optional formatting, but is a lot of work to finish I guess.
  • Otherwise the effort vs return here is extremely poor. I don’t really understand why you can’t use a normal logging system here (you don’t need to try to convince me! that’s okay!), but nothing stops you from doing /usr/bin/memcached -d -p 11211 -U 11211 -v -P /memcached/pid/memcached-11211.pid -m '53984' | ts '[%Y-%m-%d %H:%M:%S]' >> /memcached/log/memcached.log 2>&1 and getting what you want. or a perl one liner, or an awk one liner, or etc. Especially if you only rarely have log lines.

(edit: wait? -d? it’s going to fork off and close/reopen its stderr/stdouts? you should only get startup log lines for that)