by detay on 9/13/18, 10:06 AM with 59 comments
by js8 on 9/14/18, 6:42 PM
I always get complaints from users that there is too much useless stuff in the logs through which they need to go. I also think that the developer log should be structured differently, possibly to be easily read by some automation.
by testplzignore on 9/14/18, 6:23 PM
Warn: Problems that you know about and wish would not happen, but do anyways. A service call has failed, unexpected input that violates the contract of the method, etc. You may be handling these conditions gracefully and/or returning an error to the caller, but still want to know when they happen. Usually you should have a ticket open in your bug tracker for these.
Error: Problems that you do not know about. When an error is logged, a developer should look at it. Some kind of action should be taken immediately. Put the fire out if it is an emergency. If not an emergency, create a ticket in your bug tracker, then change the level to warn.
I keep warn and info separate so that I can easily grep/filter on one. I often want to just see info messages to know what the status of things are.
by exabrial on 9/15/18, 1:08 PM
by ath0 on 9/14/18, 7:11 PM
1. DEBUG - Look at this when debugging, otherwise no one will ever see it. 2. TICKET - Open a ticket and have someone on your team look at this when it gets to the top of your queue. 3. PAGER - Drop what you're doing and handle this, now.
Of course, you want to track INFO and ERROR type messages because a sufficient number of them might cause someone to raise a ticket... but at scale, you probably should've built that monitoring already, and just drop INFO/ERROR down to DEBUG.
by Dowwie on 9/14/18, 5:08 PM
by tzs on 9/14/18, 6:10 PM
> I would like to talk about the five (or six, or four) that I find are the most crucial, the fundamental set to base your own levels (and your thinking) on.
Which are the 2 from the 6 given whose status as levels of logging is in doubt?
by xtracto on 9/14/18, 6:20 PM
Everybody developer knows that they should include logging in their systems, however how and what to log is not something so well documented.
When you start working in a system (i.e. at a startup) you put the odd log here and there, without too much attention. However, as your system(s) starts growing, you have to start paying attention at your logs' structure and semantics, so that they are more useful in ELK, Sumologic and similar log searching engines.
by blaisio on 9/14/18, 10:44 PM
by grkvlt on 9/14/18, 8:45 PM
by kripke on 9/14/18, 9:16 PM
as an example of DEBUG logging is very wrong. Passwords should not end up in your logs, ever.
by jdmichal on 9/14/18, 7:10 PM
DEBUG: Information which is relevant for tracing activity and data through the program.
INFO: Important workflow decisions made within the normal operation of the program. Allows you to tell what path a particular operation flowed down, but not with tracing every activity.
WARN: Non-fatal errors which do not prevent the operation from completing. Example: Failing to close a file after having read from it.
ERROR: Fatal errors which prevent the operation from completing. Example: Failing to open the file or reading from it.
by dionian on 9/14/18, 6:48 PM
debug: low level flow of program, inputs/outputs
info: what I want to see at runtime in prod, high level flow of program, details about operation so I know what's going on if I want to look
warn: things that may indicate errors or other unexpected situations to be aware of that may be relevant to problems elsewhere
error: something serious or unexpected that probably indicates a defect.. issue that needs to be looked into... unhandled/unexpected state
by sagichmal on 9/14/18, 5:30 PM
tl;dr: Only Info and Debug levels carry their weight.
by hota_mazi on 9/14/18, 6:20 PM
Give me three levels of logging, 1, 2, and 3, and then warning, and error. Maybe allow to mix and match them, if this makes sense (the typical nomenclature makes them all mutually exclusive, which is dumb).
There are your five levels.
by dstick on 9/14/18, 6:19 PM
by cwingrav on 9/14/18, 7:49 PM
The multiple levels are nice, especially for logging errors in production and tracking general information of your software. But in development, logging is often about tracking a particular aspect in your code. You need something that logs to a particular aspect that you are working on, and then can turn off that aspect once you move on. In the future, you often find yourself back to debug and need to flip that aspect back on again.
Summary: Log levels of info, warn and error all have a place. Logging to aspects is valuable during development, easy to turn off for production and useful when returning to debug.
by stephengillie on 9/15/18, 12:38 AM
by nwmcsween on 9/14/18, 6:27 PM
by yacse on 9/14/18, 6:41 PM