More mysteries of the Python world

Logging suddenly stopped working in my ABM system. But it took a week for me to notice this, because I had had no reason to check my log files. I had moved the code to initialize logging to a central place. I ought to have checked carefully then if it still worked, but... I hadn't changed the code, just moved it, and no errors messages appeared. I checked a log file and it looked fine! (What I hadn't checked was the date of the log file: it was actually from before the change.)

What had happened was that I had moved the initialization code to a spot where initialization happened after the first attempt to log a message. In almost any language I have worked in, what I would expect in this case is one of two things:

1) The initial logging attempt would blow up with a message like "No logging initialization performed!"


2) The initialization itself would blow up with a message like "Logging already started: too late for initialization!"

Instead, Python let me start logging with no initialization, sending my messages God knows where (not to the log file, anyway), and then let me uselessly run the logging initialization code to no effect.

That is a very weird way too handle this situation!


Popular posts from this blog

Central Planning Works!