http://qs321.pair.com?node_id=1186510


in reply to Re: Choosing a log level
in thread Choosing a log level

I would place your examples at more of a DEBUG or higher level.

Useful INFO level messages that I've seen include listing off the high level parameters being passed in, summarizing the header info on input data, and noting environmental details.

That can help a lot with distinguishing between data getting mangled in your code, or being already wrong before it got to you and whom to blame for it. (Your image isn't cropped... because you told me to not crop it!)

If you're logging the right things, it can also help you go back and identify issues that you had no idea were a problem actually worthy of a much more emphatic alert. For example, I had a set of INFO values that are individually all within the original sensible limits, but after a month they clustered into two groups, and the difference between those groups is a key indicator for an undesirable hardware change which now results in an ERROR & delayed FATAL. Based on the INFO level data, the should-have-been-fatal runs could be chased down and redone.

Replies are listed 'Best First'.
Re^3: Choosing a log level
by BrowserUk (Patriarch) on Mar 30, 2017 at 20:24 UTC

    All I can add is that I do not consider the logging of a program's input parameters and other external inputs (env. vars etc.) as "cutesy informational messages"; as they are crucial to reproducing failing runs.

    I do consider the logging of subroutine inputs as "cutesy", as they (given access to the program's inputs) are reproducible, on demand, driven by need, at runtime when debugging.

    Having worked on systems that used extensive logging of every subroutine, function and method parameters, along with every detail of the programs action that the programmer thought might be useful when debugging, and having had to wade through gigabyte after gigabyte of mostly meaningless and always reproducible logs trying to work out where things went wrong, I have a strong aversion to the cutesy, guessed-it-might-be-useful kind of logging.


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority". The enemy of (IT) success is complexity.
    In the absence of evidence, opinion is indistinguishable from prejudice.

      I understand your aversion. I share it. The point of multiple log levels is to afford turning off the lesser, super-verbose logging but have the easy option to bring up more, maybe the whole enchilada, when a bug/issue eludes casual debugging. In production, I don’t send anything below FATAL and ERROR to the logs.

        The point of multiple log levels is to afford turning off the lesser, super-verbose logging

        Hm. We'll have to agree to differ I think. That still means that the source code is cluttered with lots of junk who's only function is better achieved using line(number) tracing and/or temporary print statements.


        With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority". The enemy of (IT) success is complexity.
        In the absence of evidence, opinion is indistinguishable from prejudice.

      I suspect we agree on this, and the difference in in the perspective:

      Putting Garbage in the INFO, vs the INFO being full of Garbage. INFO would be useful if you only put useful info in.

      The "cutesy" things which are nominally reproducible given the program's inputs, IMO, should be strictly at DEBUG level and are only useful when you haven't done enough work on the code yet to predict the behaviour with confidence.

      I usually have those as simple console printing, and then outright delete them when I'm done the first draft of the code and have settled on data structures and variable names. A small few may stick around to serve as progress bars, but those strings end in \r instead of \n so they aren't spammy.

        I suspect we agree on this, and the difference in in the perspective:

        Yes. I think we do.

        I usually have those as simple console printing, and then outright delete them when I'm done the first draft of the code and have settled on data structures and variable names. A small few may stick around to serve as progress bars, but those strings end in \r instead of \n so they aren't spammy.

        I also tend to delete debug trace when I'm done with it. (And have been known to leave a few sitting around as a "somethings happening" indicator.)


        With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority". The enemy of (IT) success is complexity.
        In the absence of evidence, opinion is indistinguishable from prejudice.