- 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
I can usually find Canada without superlogging. Starting in the US and heading north is one way.
Admin
One way that the logging here is excessive is when the code needlessly announces to the log file what function it's going to call next. Let's look at an example:
I'd be willing to bet that inside "getMajorClassifications()" it has (practically) the same log messages. Not only is the code cluttered, but it sounds like the log files will be a cluttered mess as well. Personally, if I'm trying to resolve a defect, especially an issue in production, I want log files that are useful to me.Perhaps Eric should have submitted an excerpt of the log file too, so we could see just how hideous it really is.
Admin
Minutely log rotations?
Admin
OK, I started in Anchorage and I'm heading North!
All I see is water so far...
Admin
It might also be useful to log some information that's handy at runtime beyond merely where you are in the code?
Surely debug-level logging should contain some run-specific info?
Admin
Updated directions:
Admin
Personally, I've used many methods of debugging and have never found using a debugger to be in any way superior to methods such as trace statements (or "logging" as you call it).
Admin
*That code could conceivably fit into one of our applications. Not one I work on ... But all of the developers I've interacted with who would be involved in that, strike me as way too smart to churn out this abortion. So I'm going to assign this snippet to one of our competitors. And then buy some more of my company's stock.
Admin
Obviously those debug and info methods in turn contain some sort of logging to record instances where they would fail, leaving dear Chris with an empty log.
Admin
Admin
Admin
The obvious benefit of a debugger is that it's like having a log statement on every single line!!! Logging requires an explicit line of code where you need to log some info, that's an overhead. Debugging (as in "with a debugger") allows you to inspect the state of the application on every single line, including the value of variables and every other bit of info you could possibly want. It's pretty obvious which is the more economic method in terms of time and effort.
Of course, there will always be times when you can't attach a debugger, but if you can attach a debugger then it beats logging by a long shot. I don't see this as a matter of taste, more a matter of fact.
Admin
Maybe both your companies work on the Peter Principle?
Admin
Unless you're in Alaska or Hawaii.
Admin
Does anyone else just switch off when folks bang on about being a "Senior Developer" or "Dev Lead".?
A guy I know has his current title on LinkedIn set as "Senior Lead Developer".
Admin
Ouch. You better go back and look for the real problem...
Admin
Admin
Wow, it's funny how much faith people put in titles.
Anyway, TRWTF is Vector. Pretty sure people stopped using that circa 1995.
Admin
Admin
Admin
better too much than not enough
Admin
If your logs start building up use this pattern to flush them:
Admin
*luck even. Bother.
<OUT OF COFFEE ERROR; OPERATOR HALTED>
Admin
Admin
Admin
Admin
Not at all true in all instances of US.
Admin
Admin
Right, I've added logging for those cases.
Admin
He said that's how you do it, not that you /must/ do it every time. See how the word 'Senior' is quoted, with ironic effect. Does this bother you?
Also, thanks for demonstrating an important point: this technique does not work if you randomly quote a bunch of words. It is important to understand irony and sarcasm before using this technique.
Admin
^^ Please mentally insert the above quotes into my previous comment. Thanks. (:/ Need caffeine!)
Admin
Admin
Going in a circle makes canada easier to find?
Admin
Admin
Admin
Admin
The syntax coloring actually makes the code easier to read, since the logging is somewhat lighter than the real code. In many editors, it would be very hard to find the code through the sea of logs.
Admin
Ah, but if you log all successful statements, the absence of a log entry clearly shows an error.
<head explodes>Admin
I don't think that explicitly pointing out sarsasm sucks at all.
Admin
And, just so nobody's confused, that comment itself was sarcastic. It's self-reference, get it?
The misspelling was just unfortunate, and not sarcastic at all.
Admin
I wonder how long it will take him to review the production logs to figure out why everything's running so slow.
Admin
I don't know what bugs me the most. The obscene amount of log calls or the misplaced comments.
Admin
Good luck with that Assburger's.
Admin
Admin
Ah, sarcasm again. Our frist is a bit of a one-trick pony, it seems.
Admin
Having to maintain pre-ANSI C running on SCO Openserver boxes, I don't have access to all of them newfangled debuggers and stuff you talk about. So to me this looks pretty normal.
Add to that, the fact that the systems in question are located at multiple sites, where the only remote connection is a modem that can do 4800 baud on a good day. Then you will really start appreciating this log pattern.
Admin
FTFY.
Admin
You're a fucking moron. And since apparently you need this sort of clarification, I do not mean that you're a moron that's currently engaged in sexual intercourse.
Admin
I'd much rather take a few seconds to sprinkle some assert statements throughout the known problem area and let the error conditions surface on their own (but even that doesn't work in all situations).
I respectfully disagree. That isn't to say that debuggers don't have merits; they are certainly useful when dealing with closed third-party libraries (where you do need every bit of information you could possibly want).My problem with debuggers is that for many programmers, running the debugger becomes a knee-jerk reaction whenever something seems amiss. No thought goes into where the root cause of the problem might be and what might be the best method to identify it. They just fire up the debugger and step through the code.
My point is that there are so many methods for debugging code; all of them can be just as useful as a debugger (in some situations more so, in some situations less).
Admin
As long as your code ends up de-buggered in the end, that's all that matters.