Path: csiph.com!usenet.pasdenom.info!aioe.org!.POSTED!not-for-mail From: Novice Newsgroups: comp.lang.java.programmer Subject: Re: Exception Handling Date: Mon, 12 Mar 2012 17:43:50 +0000 (UTC) Organization: Your Company Lines: 92 Message-ID: References: NNTP-Posting-Host: e/7k2xPBpzXEhFbqYoZT4A.user.speranza.aioe.org X-Complaints-To: abuse@aioe.org User-Agent: Xnews/5.04.25 X-Antivirus-Status: Clean X-Notice: Filtered by postfilter v. 0.8.2 X-Antivirus: avast! (VPS 120312-0, 2012-03-12), Outbound message Xref: csiph.com comp.lang.java.programmer:12904 Arved Sandstrom wrote in news:yPa7r.13504$wf.12231@newsfe09.iad: > On 12-03-11 06:54 PM, Novice wrote: >> Lew wrote in >> news:jjipli$np7$1@news.albasani.net: >> > [ SNIP ] > >>> We've discussed this before, remember? >>> >>> It's not expensive. When you're calling a logger statement for an >>> error, the cost of the error SWAMPS the time in the logger. Think >>> about it. >>> >> I suppose I'm too easily swayed by other opinions. Arved, who seems >> very knowledgeable, cited that article, which seemed to give it his >> seal of approval. I don't know the author of the article but I tend >> to assume he must be an expert to be asked to write about a Java >> topic. The author cites people who he considers experts and the >> upshot is that the advice seems to argue against putting positioning >> information in the log unless its necessary (which it probably isn't >> if the stacktrace is in the log). Now you make a persuasive argument >> contradicting the article. I'm satisfied that you have serious >> expertise in this area so I have no reason to dismiss your argument. >> But why didn't the experts who wrote the article modify their remarks >> accordingly? > [ SNIP ] > > The article did have my "seal of approval". That's to say, I read the > article, and agreed with most of it. Not 100 percent, but most of it. > And I didn't see anything in it which would lead a person down the > garden path. I recommend it because it's a useful read...but you > shouldn't accept it as the gospel, just as you shouldn't accept > "Effective Java" as the gospel either. > Absolutely. Please understand that I didn't mean to imply that you gave your whole-hearted endorsement to every bit of it. I just meant that you'd suggested it in an approving manner, which suggested that it was basically sound, not necessarily perfect in every detail. > Logging is also a somewhat subjective matter. That's why different > opinions on different specifics. Ultimately TIMTOWTDI, to borrow a > Perl motto. I dabbled in Perl briefly some years ago but didn't know that acronym. But, as Lew likes to remind me, Google is my friend so now I know what it means ;-) > What really counts is when the rubber meets the road, and > the logs have to be _used_, did the ops support people get what they > needed out of the logs, without too much anguish? > That makes perfect sense to me. > You've heard different viewpoints - mine and others' - on including > positional informational in logs. In the final analysis what matters > is the sufficiency of information in the logs. Don't worry overmuch > about logging performance until it's a problem; the whole point of > having layouts in a properties file is that you can tweak them if > necessary. I have a specific reason why I don't normally include > certain positional information, except for error stacktraces, but > someone else might have a good reason for why they do want this info. > Speaking with my programmer hat on, I tend to find that the stacktrace meets most of my needs. I mostly use the class name, method name, and line numbers to see where the problem is and what the message is. And I don't tend to worry about performance until it starts to become an obvious problem either. But I always start feeling a bit anxious when people start talking about performance and wonder if I'm shooting myself (or my system) in the foot with the techniques I use. But, so far, that hasn't been a frequent problem. > One note: *never* assume that because somebody has an article in a > blog or an Internet magazine or a dead tree magazine or even a > scholarly journal that they are experts. Check the references. Check > the style of the prose: are the conclusions backed up by > understandable argument, or are they just "put out there"? Google for > other articles on the same topic. > In all honesty, I had that in the back of my mind too. I don't really blindly assume that everything I read is written by an expert. I tend to give people the benefit of the doubt, especially in topics where I have minimal knowledge, but I know that some articles are just nonsense. But if a guy who knows his stuff (like you) recommends an article to me and it is in a journal that I haven't actually heard trashed by someone knowledgable, I tend to assume that knowledgable editors will have done a conscientious job of keeping out anything that is complete nonsense. But I realize that is hardly a bulletproof approach. So I do retain some basic skepticism about things I read ;-) -- Novice