- 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
turtles standing on top of turtles, but what does the frist turtle stand on?
Admin
The first frist comment failed, this is the second attempt...
Admin
Admin
How can you type 'ExceptionLoggerLoggerLoggerLogger' without feeling stupid??
And why did he stop at 4?
Admin
Exceptional Indention Indention Indention
Admin
WTTTTTF!?
Admin
Reminds me of the trace buster buster buster
https://www.youtube.com/watch?v=Iw3G80bplTg&feature=kp
Admin
TRWTF is the logger inheriting from Exception.
Admin
sorry, but its turtles all the way down!
captcha "sagaciter", how appropriate :)
Admin
The other extreme: Around here a lot of people just do this:
try { ..... } catch ex { }
When you ask, the most common answer is: "I don't want the application to crash."
Admin
I haven't had any experience with Java performance troubleshooting, but do exception handlers really cause overhead, in the common case where no exceptions are thrown? I ask because they don't have to, and don't in other languages/environments: for C++ (depending on the ABI), for example, the runtime is able to detect whether there's a handler without the calling code having to waste instructions on setting up such a handler. And even if Java does have some noticeable cost for setting up the exception handler, how can the complexity of the handler be an issue if the handler isn't invoked?
Admin
Admin
TRWTF is the utter lack of code review that allowed the greenhorn to commit that monstrosity and have it go to production.
Admin
Admin
OO code is stupid, and people who code OO style are stupid. Exceptions are stupid. And so is your stupid face.
In conclusion, this whole stupid WTF could have been avoided by using a decent and proper language that doesn't have stupid exceptions and stuff.
Captcha uxor. I uxor to marry me, but she said she wouldn't marry a man who didn't code in C hash. I told her she was making a hash of it, and took the ring and married a man who knew BASIC instead.
Admin
Admin
Every language I have encountered incurs some overhead of an exception handler being implemented, even if the exception is never thrown**. In many cases the overhead is so small it can be ignored (i.e. it may be on the order of sub-microsecond - but still non-zero).
** The exception (pun intended) is if the compiler can determine that the exception can not possibly be thrown. Under these conditions I have seen environments that optimize the try/catch out of existence (but then is the try/catch really implemented at all???)
Admin
Needs more discourse bashing...
Admin
The questions are quite reasonable. If more people put thought into error handling we would be struggling to fill the Friday Error'd column.
The answer is, of course, wrong.
Admin
Thanks guys, I've got an earworm now.
ExceptionLoggerLoggerLoggerLoggerLoggerLoggerLoggerLoggerMushroomMushroomSNAKE
Admin
I have made a similar pattern to this myself (honestly it needs some refactoring). I don't understand the intention in the example given above though.
For for me it was due to three main factors:
In essence the system made it possible to use exceptions in a nice way and handled a lot of headaches automatically. For example, something like throw new UserException('You must enter a password'); would automatically propagate to the user with no need for developer input. Where as an unsafe exception type would have the message supressed. This kind of system has its ups and downs but worked pretty well for RAD.
It logs excessively (about three times) but errors are infrequent enough that it's not a big concern for us yet.
Admin
On Error Resume Next
Admin
Just use PHP it's built in.
Admin
C-pound, surely?
Admin
I had to do a double-take after I read this since I saw it was posted by Erik Gern. It's probably the least "Gernified" post I've seen by him.
Admin
How many logs would a log exception log if log exception could log logs?
Admin
Admin
It's a hash (U+0023).
No one outside the USA has ever used a hash as a Pound Symbol (£ U+00A3).
A Sharp is U+266F.
Admin
OK, the exception handling/logging is crazy. However, I would like to see more of the code where it was used. For the error handling to be a big bottleneck, I have to think that it's either worse than shown here or the code is throwing a ridiculous number of exceptions and there is a bigger WTF on the way.
Admin
It's looooooooog, loooooooooog! It's big, it's heavy, it's wood! http://www.youtube.com/watch?v=RTrAVpK9blw
LOL you can even make the infamous wooden table out of it.
Admin
TRWTF is the lack of code review at this company. Everybody is a complete clueless moron at some point in their career. Junior developers (i.e., "greenhorns") are not going to be experts out of the starting gate. This code should never have made it to the product. It should have been flagged in a code review and the greenhorn should have had good exception-catching practices explained to him.
Admin
Admin
Is the handling of exceptions part of normal program flow? And if so, why are they logging those exceptions?
And how does the fact that there are 4 layers of redundant loggers contribute to the bottleneck? Does LogMessage() actually fail?
Admin
Yes and logger, logger, logger, logger, logger, logger, logger come back to me :)
Admin
Clearly the guy who wrote this always wanted to be a lumberjack.
And that's okay.
Admin
The last one of course.....
Ouroboros...
Admin
Finally!! A story that does not end with "And Peter left the company shortly thereafter."
Admin
Because in this case, it clearly should have inherited from Inception instead.
Admin
Admin
Needs more polymorphism, so we could go…
Logger logger logger logger logger chameleon, You throw and fail, You throw and faaaaaaail…
Admin
Admin
But it doesn't distract too much from the story and there is a real WTF after all.
So for reference, in case EG is reading this (I know he isn't), this is just the acceptable level of embellishment. Not a little bit more than this.
Admin
the second turtle, duh.
Admin
A former boss called it "C-Plus".
Captcha: similis; c-plus is similis to c-plus-plus.
Admin
Yes, but is it a male or female turtle?
Admin
The right way to do it, of course, is with a recursive logging method that will call itself again when an exception is thrown. Then you're sure that the system will do everything it possibly can to get that error message out.
Admin
Amazing. An Erik Gern story in which TRWTF is the code, not a ridiculous, overly embellished story. I approve. Perhaps there is hope for him yet.
Admin
Those who don't know recursion are doomed to repeat it.
Admin
Admin
Logging can of course fail. Ever heard horror stories of a server that ran out of disk space when some log file filled it all up, and random daemons start having errors trying to log their errors? That's fun, especially when you can't SSH in because your SSH daemon logs all access... Do you have emergency solutions to crazy situations?