|
|
|
| Hurry! Enter The Daily WTF's OMGWTF2 Contest by June 28th! - Prizes! Fame! Trophies! Do your worst: http://omg2.thedailywtf.com/ |
| « Prev | Page 1 | Page 2 | Next » |
|
I've seen this done to integrate CLi only applications with a front end, but never for logging. Of all the ways to do it, what the hell could the developer have been thinking?
|
|
Excpection occurred writing FRIST entry.
CAPTCHA: causa (and effecta?) |
|
It's also not platform independent...
|
|
And what happens when the application tries to log "; rm -rf / # ?
|
Re: Fork and Log
2013-02-13 08:28
•
by
Bobby Tables
(unregistered)
|
Exactly. So doing a System.out.println() would not have been equivalent to this code, see ... |
"I know one way to log things." (hammer, nail, etc.) |
"Hey, Adam, you broke my code! I always do error(foobar, "waiting for data; sleep 1");After your last change, this doesn't wait for the data anymore." http://xkcd.com/1172/ Akismet is great. Akismet is great. Akismet is great. Akismet is great. Akismet is great. Akismet is great. |
That wouldn't actually work, as Runtime#exec isn't a fully-fledged shell. The reparsed log message will be passed as arguments including ";" to /usr/bin/logger rather than being used to spawn additional processes. |
No, no, no. The correct tool for logging is a chainsaw. I recommending using the chainsaw to remove the offending programmer's eleventh finger. You know, the large one attached to the top of his torso, between his shoulders. It's commonly called a "head" for some reason. |
|
I have cause on occasion nowadays to read java (rarely needing to write it any more) and have at time bewailed the fact that log4j isn't routinely used. The answer I get is that the logging package and the techniques therein were written well before log4j was invented, and there is no need to break a perfectly well-written and documented existing package, despite its having been written in-house.
This may have been the reason behind the initial coding of this particular instance, but the follow-up thought (that this is perfectly well-written) is admittedly less accurate. |
That's not a finger. That's a dick. |
In other words, use the Chainsaw logging tool to truncate the programmer. |
Re: Fork and Log
2013-02-13 09:07
•
by
BogusArgumentException
(unregistered)
|
Since when does Runtime.exec() calls a shell interpreter? |
|
I had a similar thing once, where I could write the error to the log about the error writing to the log - there were unicode characters in the original error message that couldn't be translated to the ASCII-encoded output.
|
|
I would like to see you try logging with only a hammer and nail...
|
No, no - that's the zeroth finger. |
|
The first thing I see in this code is the remote code execution bug. Performance problems are secundary to this
|
So? The bandwidth may be smaller than with all that newfangled technology, but otherwise ... |
Actually, a nail is preferable. With a fork you get triple lines. |
Re: Fork and Log
2013-02-13 10:18
•
by
Paul Neumann
(unregistered)
|
Actually, a fork will give you quad lines. You're thinking of a thirk! |
Re: Fork and Log
2013-02-13 10:20
•
by
OldCoder
(unregistered)
|
Heh. Interesting. Way to get sidetracked... Well, it is a slow afternoon here... |
|
Wowza. That's a lot of hassle to avoid using the built-in logger.
static final Logger logger = Logger.getLogger(ActiveModel.class.getName()); |
Yep, with the added bonus as being fireproof (actually a fire may in some instances improve durability, refer Knossos) Yours Yazeran Plan: To go to Mars one day with a hammer. |
|
A Perl programmer wrote this. They cannot help themselves. They will do it every time.
|
Right, so the real WTF is incorrect comments getting featured. Although I must admit it is more fun that way. He should have executed "/bin/sh -c logger blahblahblah". That immediately saves you from having to type the exact path to logger, so it's better right? |
|
Not sure how we're going to fit the President's sick daughter into this story, but at least we do have an 'auditor' of sorts, and perhaps there will be a grilling session later for Santosh.
|
Re: Fork and Log
2013-02-13 11:47
•
by
urza9814
(unregistered)
|
Santosh, having been driven insane by the immense pressure, had recently taken the president's daughter hostage. Seeing his laptop nearby, still logged into the SVN server, she knew this was her only chance for rescue. She waited until he was distracted, and then began typing her message. Knowing Santosh would quickly discover this attempt, she had to encode it in a code segment that appeared to match his usual poor quality. So she typed away some seemingly useless code into the logger routine and committed the changes. Unfortunately, the first person to stumble across that particular code segment was Adam C., who failed to perceive its importance. Since the message was deleted, she was never rescued and was killed by Santosh, who then committed suicide. Good job Adam. Way to go. All your fault. |
From what I recall of Santosh's code, grilling him would be appropriate. I recommend emulating the folks who used to grill burgers at the student union when I was at uni - they could persuade half a dozen ordinary quarter-pound burgers to produce a sheet of flame about four feet tall. |
|
I'll never understand why most error logging that you see is exceptionally horrible.
|
Re: Fork and Log
2013-02-13 12:38
•
by
Anonymous
(unregistered)
|
That gives a whole new meaning to "giving the finger". |
|
What a forking joke
|
Runcible spoon or GTFO. |
Re: Fork and Log
2013-02-13 14:11
•
by
AN AMAZING CODER
(unregistered)
|
I was going to troll you about using log4j, considering it's pretty old and being replaced by Logback (and even SLF4J). But, if those are the type of people you deal with, you don't deserve that type of trolling :-( |
Re: Fork and Log
2013-02-13 14:15
•
by
Paul Neumann
(unregistered)
|
Still a quad line. |
Re: Fork and Log
2013-02-13 14:21
•
by
Paul Neumann
(unregistered)
|
No, it doesn't. The symbolism remains intact. |
|
Can a logger call itself to log exceptions?
|
You never look at error logging on systems that work, because, well...they work. |
|
In the same vein, I’ve seen this way to determine if a process is still running :
proc = subprocess.Popen("ps -fed | grep " + str(process.pid), shell=True, stdout=subprocess.PIPE)
Not only this code create three processes each time it runs, but the probability of false positives is relatively high… The kicker? Since the process in question was started by the Python’s subprocess module, the previous code can be rewritten to: is_alive = (process.poll() is None) |
The fork will put more holes into the trunk than a nail, making your logging three or four times faster. |
|
Maybe this is a naive question, but why did the try block fail, anyway?
|
Naw, Sys::Syslog is part of the perl core, and easy enough to use. Bad code (or, rather, code that doesn't use built-in language features) is easy to write in any language, you know. |
Re: Fork and Log
2013-02-13 16:33
•
by
Key Logger
(unregistered)
|
No one designs for errors, so no one tests for errors, because no one wants errors, therefore they play this little mental mind trick and fool themselves into believing there will not be errors. I mean, did you ever sit down in a project kickoff meeting and hear "first of all, we want any problems that come up to be recorded in a way that will support statistical analysis to help us find and learn from our mistakes"? No. We don't make mistakes, so why would we want to know about them? That's also how most security vulnerabilities arise. |
Re: Fork and Log
2013-02-13 20:09
•
by
Norman Diamond
(unregistered)
|
Of course. We saw it right here, and we've seen other examples in the past. Well in cases like this, it's exceptionally exceptionally horrible, and when that fails it's exceptionally exceptionally exceptionally horrible. Also don't forget all those programs that use exceptions to process ordinary, expected events. Logs of those events are even more exceptionally horrible. Success can be worse than failure. |
Exactly. So when he junked this code, he broke the application. (http://xkcd.com/1172/) But he can fix it quick by adding a flag to say whether it works the old way or the new way. |
Magyver would have just held down the space bar until the laptop overheated and the room caught fire.... |
I didn't even click on the link and knew it was some fag linking xkcd. It's not clever. It's not funny. Just the word "colors" with a link under it and the short, useless, one sentence post was all I needed to know that you were linking the cartoon where the men demonstrate their knowledge of other "colors". It was funny to read when it came out. It's even funny when clicking on the Random button on the site and seeing it. It's NOT funny when someone links to it from a one-sentence post and thinks they're so fucking clever to have discovered xkcd. You probably still use lmgtfy and think you're so damn clever. It means in real life, you're an unoriginal hipster doofus. Got anything to do with sanitizing inputs to a SQL database, etc.? Link to Bobby Tables. Got a nerd-project slow-ass turing machine? Like a minecraft logic circuit from redstone? Link to the one where it's some guy alone in the world making a computer out of rocks. Got a story about password security or encryption? Link to the one where they beat the password out of the guy with a wrench. Fuck off. You're not clever. |
What the actual fuck are you talking about? Do you understand the irony in calling someone an unoriginal hipster then proceeding to demonstrate your apparent knowledge of the same fads you (conveniently) now hate in your tirade of abuse? You are a fop. |
|
Ah, there's the bottleneck:
public void error(String logID, String errStr) {
He should have used StringBuilder instead. No need for a thread-safe object that is instantiated within a method. Geez, don't people read the JavaDocs?
|
Thank you, Sheldon. |
Would've helped with yesterday's WTF. |
| « Prev | Page 1 | Page 2 | Next » |