My Code Complains Loudly, Unless Gagged
15 January, 2002
Ok, so I had to write the logging component for our system. Since it's the lowest-level logging that gets used and all the messages coming into it get logged into a file, I made the code very verbose when it gets errors. I did this because there's no lower level to complain to. I also did it because, hey, if you're calling the logging component, you've already encountered an error condition -- my code does not return errors. So there are calls to logMsg() sprinkled throughout the code.
This week one of the other guys is integrating his code with this logging component. And he is having problems. So I go over to his office, checking things out.
"Are you getting output on the console?" No.
"Complaints anywhere??" No. Simply not getting any ouput to the output file; the output file isn't even getting created.
Huh. I must have some stupid bug in the logging component that is caused by interaction with either his code or a previous integration. I go back to my machine, synchronize with the branch he's working on, and create my own build. Sure enough it doesn't work. So I go into the log object and put a call to logMsg() where the file is opened. Rebuild, reload, rerun the test. No output. Hmmmm. Call logMsg("foo") from the shell. No output. Do an i() at the shell. No tLogTask. Hmmmm. Open usrConfig.c, look for logInit(). Commented out.
"Hey, any reason logging is turned off?" Uhhhhhhhhh.
Uncomment the call to logInit(). Rebuild, reload, rerun the test. Complaints galore. Find the problem, point to where the logging component is being misused, describe how to fix it. Instruct user to reenable logging and let me know if he finds another bug...