'Why would one format date in logs using "%c"?
A widely used piece of code sets the default datefmt in logging.Formatter to "%a %b %d %H:%M:%S %Y %Z" (same as "%c" in C locale).
The code was written 12+ years ago and the author is unavailable.
I have never seen such log formatting before.
I find "%Y-%m-%d %H:%M:%S" more convenient (it sorts chronologically the same as lexicographically and is shorter). I am trying to figure out what the rationale might have been.
Solution 1:[1]
This is the same default format used by the date utility on most *nix systems and is intended to be more human-readable than an ISO 8601-ish format. I would assume this decision was made to stay consistent with preestablished defaults.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | plentyofcoffee |
