6 ms·
That's what the DEBUG level is for, as explained at the end of the section you're referring. So it would be like: D: Connecting to DB D: Reading config
by raldi 5y ago
That's what the DEBUG level is for, as explained at the end of the section you're referring. So it would be like:
D: Connecting to DB
D: Reading config file
D: Connecting to API server
D: Sending updated record
I: Updated user record for $USER
Or, if it fails, the last line is replaced by:
E: Failed to connect to API server; could not update user record. [IP=..., ErrNo=..]
- theshrike79 5y agoThe log file should, by default, have all necessary info to debug the issue - or at the very least enough information to narrow down the problem so far that you can replicate it locally. I've spent way too many hours adjusting log levels on a client environment and trying to replicate the issue without breaking or losing data while doing it.
- dezzeus 5y agoEven though it can be lost by an optimistic configuration, I prefer to use the TRACE level(s) and leave the DEBUG one for, well, debugging.
- raldi 5y agoWe're discussing a NullPointerException situation; how is that not debugging?
- Leherenn 5y agoI think OP's case was not debugging a crash, just that if a crash happens he would like the log to be before rather than after. The log statements would be there no matter whether there is a crash or not, just in case.
- yongjik 5y agoPersonally I'm not a fan of DEBUG level (unless you always keep it on). You can have a transient system issue that appeared for 30 minutes and then went away. If DEBUG logs weren't turned on at the time, they won't help me.
- Jowsey 5y agoWhy not have the program write logs to a temp file somewhere at trace/debug level, and only output the standard level to the console?
- Cicero22 5y agoWouldn't that end up slowing down the whole system from writing to a file though?
- Jowsey 5y agoAh, suppose it depends on how much you're doing and/or how verbose your logs are. If you've got lines speeding past then yeah I maybe wouldn't write them all.
- grey-area 5y agoWriting verbose logs is very expensive.
- worik 5y agoIt depends which costs what. In a case where there are plenty of resources and the thing you are logging is very heavy then even verbose logging is trivial. If you are beset by failures it is much cheaper than making your developers guess.
- raldi 5y agoOf course you always keep it on — the point of the different levels is that you can filter them out at read time (e.g. to eyeball logs, or to alert when the rate of >= WARN is too high)
- sagichmal 5y agoNope, this produces unmanageable log volume.
- mirekrusin 5y agoDebug level is not for production, it's for debugging.
- raldi 5y agoHave you never needed to debug an issue that was only happening on production?