- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
Log it all (and send a copy to his email box, since he deems it so important).
Oh, and frist!
Admin
I am missing the try...catch construction that sais "logFile.debug("something happened, moving on");"
Admin
How is he going to log the inevitable "disk full" error?
Admin
You keep using this word, I do not think it means what you think it means.
http://dictionary.reference.com/browse/meritocracy
Admin
// Begin text logFile.info("START: Comment Text"); logFile.debug("Write first line"); Logging is very important I don't see the problem. logFile.debug("Write second line"); It looks like a really good model logFile.debug("Captcha text line"); -capio logFile.info("END: Comment Text.");
Admin
I'm betting he once made a log method that tried to log something. I know I did ;-)
Admin
I particularly love the fact that the success case is logged in minute detail, whilst in the error case the log message is... commented out.
CAPTCHA: validus, which is close to describing the approach Christophe takes. Provided you add "in", that is.
Admin
INCONCEIVABLE!
captcha: damnum - that damnum keeps overflowing. mayne i should make it a long...
Admin
Did you think about irony?
Admin
Is it a coincidence that the code is about drugs?
Admin
AARGH! The use of whitespace and commentary seems to associate each log entry with the preceding line, but the content is actually associated with the following line.
Surely this must be enough to convince management that he is completely deranged.
Admin
Admin
This.
Also, this looks like log4j. If I saw someone puling this crap I would put an appender in that redirects the log output to his email box.
Admin
logFile.info("Did XYZ"); logFile.debug("Just invoked logging function with arguments: "logFile.info("Did XYZ"); ""); logFile.debug("Just invoked logging function with arguments: "Just invoked logging function with arguments: "logFile.info("Did XYZ"); "");
...
Admin
I wonder if he always calls methods twice, once for logging and one for usage. That should work great for iterators...
Admin
I am willing to bet the "senior" devs at that company really do consider themselves a Meritocracy based on seniority alone without regard to talent.
In fact in my career I would say I get brow beat due to my age without regard to my experience. (10 years industry experience at 29). Then when I do get to an age where I can perform the same, I get scoffed because of the low amount of time at the company.
Admin
whoosh.
Admin
// gets drugs 'nuf said
Admin
Management probably sees that he wrote at least twice as much code as other developers and so he must be at least twice as productive. Make him the "senior" developer!
Admin
TRWTF is that he didn't log the 'else' condition.
Admin
For a medical product, these logs are great because you can track everything that was done.
Maybe I'm too anal, but I can't really see the WTF here. If the code passage is mission-critical I can understand the massive logging capabilities.
TST
Admin
Actually it might be a good idea, to have logger plugged everywhere throughout the code as long as you have a nice way to turn it on/off, preferably at a module level granularity, when the interpreter is so slow that the impact is negligible anyway. In compiled languages you usually have preprocessor and thus can define log(x) to do nothing. But then you can not just turn it on/off on production. I can imagine some crazy way to force JITed languages to change implementation of log(x) on fly. Since I can, then probably it is already built in into .NET or something. But then again, I think it would be much better to have just a Trace mechanism built in into the interpreter/runtime environment/ or just a debugger, so that the developer doesn't have to echo each line of code to log(x).
I found, that Math has a log function, but it doesn't do what I need, though.
Admin
So... the logfile could contain:
Clearly more logging needs to be added, so you can tell which variable is null after the fact.
Admin
I do hate it when people come on and defend mad practices in coding but I once had to fix a piece of problem code existed in a routine that, when run in a debugging tool (I don't want to say which one), would crash and die horribly. I spent some really long hours trying to fix the issue and then as a last gasp attempt I just ran it outside the debugger it worked perfectly. I was stung by that and it stayed with me to never trust debuggers 100%. However, obviously this code should never, ever make it to a production build.
Admin
I'd like to say I've never seen quite that degree of logging abuse before. Yep. I sure would like to be able to say that. sigh
Admin
I have logged your error, pray get off mommy and daddy's wooden table.
I might hazard a guess that the log function will read a "Save stuff" option. I've done similar for remote assistance with an app. "It doesn't work." "Be more specific?" "It errors" "Gah. Run THIS version. Send us log." Everything they were doing wrote out, though not quite every single line being logged.
Admin
gerontocracy is the word.
Admin
this is not what you mean: "meritocracy" this is what you mean: "gerontocracy"
further information: http://en.wikipedia.org/wiki/Gerontocracy
Admin
We had Pokemon exception handling ... now Pokemon logging ... are we creating a meme here?
Admin
Just as an aside, I always hate it when I see this in a coworker's code:
Admin
Admin
For consistency, I hope he's dealt with the case of debugging errors inside logFile.debug()?
Admin
Half expected to see: logFile.debug("Reticulating Splines.");
Admin
This is brillant!! You accomplish debugging, logging and commenting all in one step. Truly a revolutionary approach.
Admin
With log4j (which this looks like) you can set it so that you can change the log level and not bounce the app.
All you need to do is run at info level or coarser and your debug level logs won't appear.
At least (generally speaking) the logs are informative. I've just been clearing out messages that say just "Entering loop" in every iteration of a many-thousand-times-executed loop and cut the execution time by more than half.
Seen enough worse stuff than this to opine "Not a WTF", just a bit unwieldy and inflexible. If you find yourself working in a regime that insists on it, though, all I can suggest is: that's what Monster's for.
Admin
By logging it! Didn't you read the article?
Oh, hang on...
Admin
I have to admit I did something exactly like this just recently. The reasoning for it was that there was a bug on a client's machine in Canada that I couldn't reproduce for the life of me. Turns out it was specific to his environment, and it was crashing in such a strange place that I wouldn't have found it if I hadn't done SuperLogging. Fixed! Definitely, definitely not something to do on a regular basis, but hey, it saved me.
And seriously, no "yo dawg, I heard you liked logging" jokes yet? I'm ashamed.
captcha: minim, the minimal spelling of minimum.
Admin
Admin
At least those are all debug statements. We had a developer who was similarly (but not quite to that degree) overzealous about logging, and since the debug statements didn't show up in certain circumstances (when running from NetBeans IDE - though that is easily fixable by changing the log config files) they put everything in info (or warn or error there was a problem), including the beginning and end of all method calls.
Admin
It's better than bad, it's good!
DaveE
Admin
I think he knows very well what that word means and was being sarcastic.
Admin
Another great debugging method is the use of trace statements. However, this article takes that to the extreme, since the messages featured here basically reproduce the code's documentation every time it's executed. I just hope that the logFile has more than one "log level" (as it appears to), and enough sense to throw out anything below the defined log level. Still, even if it did it sounds like Christophe was so freakin' stupid he was running it at the "debug" log level in production*.
** No, the log files were not of any use to anyone.
Admin
I don't see the WTF here, as long as it's temporary, has a Log/No log switch, and helped find bugs. If you have to do that in order to have a robust production system in the end, do it.
Admin
Now all we need to do is invent a log-to-bytecode compiler, and we can do away with the code itself altogether!
Admin
TRWTF is that he chose to clutter up the source code with all this logging code, when he could have just hacked the compiler to log a copy of each line of source any time the corresponding bytecode is executed.
Admin
Admin
Inconceivable!
Admin
Setting aside the "diarrhea" aspect of this technique, the grouping would bug the hell out of me. If you're going to log something about your code, don't put that log statement with the previous piece of code. That's like putting the first sentence of each paragraph at the end of the previous paragraph.
In our codebase, it's also one way in which comments get orphaned or not updated when the portion of code they refer to is changed. In my mind this grouping hinders the clarity of your intentions just as much as having 400 of these logging statements scattered throughout your code. yuck.
Admin
Admin