Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

It is one thing to log something that happened in code, a process, or procedure. It is another thing to log something that didn't happen. For example, if your ETL system is supposed to receive a file every hour for import, and a file did not arrive at the usual appointed time, then it would be good to log "what didn't happen."

I've called this negative logging, but I'm curious if there is an industry common term for this - a term which means "log both what happened and what didn't happen." Any idea?

share|improve this question

closed as primarily opinion-based by gnat, GlenH7, Dan Pichelman, MichaelT, Kilian Foth Oct 23 at 9:29

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise.If this question can be reworded to fit the rules in the help center, please edit the question.

    
A: what happened? B: nothing happened A: and? B: that means it's baaaadddd... You shouldn't log something that didn't happen, that is called "liar logging"; what you can do is to log for a failure of your expectations. –  Lie Ryan Jun 8 '11 at 2:01

2 Answers 2

You literally cannot log something that didn't happen. It is a physical impossibility.

What you are logging is just another type of failure - i.e. that a particular trigger was fired and the corresponding operation failed to execute. That is simply an error like any other.

Technically you're actually logging a pair of events: (a) the trigger and (b) the result of the operation. If the result log entry does not exist, then you infer a failure. This may seem pedantic, but it's actually an important distinction. You don't actually know for certain that the operation didn't execute; you just can't confirm that it did execute, and you're making an assumption.

There are two patterns for this, although I don't think they're officially-named "design patterns". They are the watchdog pattern, which repeatedly polls an endpoint to make sure that it is online and/or reporting some status, and also the heartbeat pattern, in which the endpoint itself is responsible for pushing status updates, and if the heartbeat monitor does not receive one, it logs an error.

Every instance of "negative logging" I've seen involves one of those patterns.

share|improve this answer

I've never heard of "negative logging", but the thing that would be writing to the log sounds like a watchdog process/thread. When talking about it I'd probably refer to the "watchdog log" and not really think about the whole positive/negative aspect of it.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.