You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shindig.apache.org by li...@apache.org on 2009/08/03 08:40:55 UTC
svn commit: r800211 -
/incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/image/BasicImageRewriter.java
Author: lindner
Date: Mon Aug 3 06:40:55 2009
New Revision: 800211
URL: http://svn.apache.org/viewvc?rev=800211&view=rev
Log:
tamp down some exception logging. remove some hay from the haystack
Modified:
incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/image/BasicImageRewriter.java
Modified: incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/image/BasicImageRewriter.java
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/image/BasicImageRewriter.java?rev=800211&r1=800210&r2=800211&view=diff
==============================================================================
--- incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/image/BasicImageRewriter.java (original)
+++ incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/image/BasicImageRewriter.java Mon Aug 3 06:40:55 2009
@@ -201,13 +201,13 @@
response = getOptimizer(response, imageFormat, image);
totalRewrittenImageBytes.addAndGet(response.getContentLength());
} catch (IOException ioe) {
- log.log(Level.WARNING, "IO Error rewriting image " + request.toString(), ioe);
+ log.log(Level.WARNING, "IO Error rewriting image " + request.toString() + " - " + ioe.getMessage());
} catch (RuntimeException re) {
// This is safe to recover from and necessary because the ImageIO/Sanselan calls can
// throw a very wide variety of exceptions
log.log(Level.INFO, "Unknown error rewriting image " + request.toString(), re);
} catch (ImageReadException ire) {
- log.log(Level.INFO, "Failed to read image. Skipping " + request.toString(), ire);
+ log.log(Level.INFO, "Failed to read image. Skipping " + request.toString(), ire.getMessage());
}
return response;
}
Re: svn commit: r800211 - /incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/image/BasicImageRewriter.java
Posted by Paul Lindner <li...@inuus.com>.
Okay, I'll take your suggestions and move that to fine. That particular
method will often log EOFExceptions if the underlying request cannot
complete in a reasonable time.
On Mon, Aug 3, 2009 at 4:38 PM, Adam Winer <aw...@google.com> wrote:
> I generally disagree with this: I believe exception stack traces
> should always be logged.
>
> If this individual exception is occurring too often, you could:
> - install a log handler that snips exception traces
> - lower the log level overall
> - log twice, the second time at FINE with the exception
> log.log(Level.WARNING, "IO Error rewriting image " +
> request.toString() + "-" + ioe.getMessage());
> log.log(Level.FINE, ioe);
> - best of all, use log levels to decide whether to include the stack
> trace:
> if (log.isLoggable(Level.FINE)) {
> log.log(Level.WARNING, "IO Error rewriting image " +
> request.toString(), ioe);
> } else {
> log.log(Level.WARNING, "IO Error rewriting image " +
> request.toString() + "-" + ioe.getMessage());
> }
>
> ... so anyone that needs to diagnose the exception has some recourse.
>
> On Sun, Aug 2, 2009 at 11:40 PM, <li...@apache.org> wrote:
> > Author: lindner
> > Date: Mon Aug 3 06:40:55 2009
> > New Revision: 800211
> >
> > URL: http://svn.apache.org/viewvc?rev=800211&view=rev
> > Log:
> > tamp down some exception logging. remove some hay from the haystack
> >
> > Modified:
> >
> incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/image/BasicImageRewriter.java
> >
> > Modified:
> incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/image/BasicImageRewriter.java
> > URL:
> http://svn.apache.org/viewvc/incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/image/BasicImageRewriter.java?rev=800211&r1=800210&r2=800211&view=diff
> >
> ==============================================================================
> > ---
> incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/image/BasicImageRewriter.java
> (original)
> > +++
> incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/image/BasicImageRewriter.java
> Mon Aug 3 06:40:55 2009
> > @@ -201,13 +201,13 @@
> > response = getOptimizer(response, imageFormat, image);
> > totalRewrittenImageBytes.addAndGet(response.getContentLength());
> > } catch (IOException ioe) {
> > - log.log(Level.WARNING, "IO Error rewriting image " +
> request.toString(), ioe);
> > + log.log(Level.WARNING, "IO Error rewriting image " +
> request.toString() + " - " + ioe.getMessage());
> > } catch (RuntimeException re) {
> > // This is safe to recover from and necessary because the
> ImageIO/Sanselan calls can
> > // throw a very wide variety of exceptions
> > log.log(Level.INFO, "Unknown error rewriting image " +
> request.toString(), re);
> > } catch (ImageReadException ire) {
> > - log.log(Level.INFO, "Failed to read image. Skipping " +
> request.toString(), ire);
> > + log.log(Level.INFO, "Failed to read image. Skipping " +
> request.toString(), ire.getMessage());
> > }
> > return response;
> > }
> >
> >
> >
>
Re: svn commit: r800211 - /incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/image/BasicImageRewriter.java
Posted by Adam Winer <aw...@google.com>.
I generally disagree with this: I believe exception stack traces
should always be logged.
If this individual exception is occurring too often, you could:
- install a log handler that snips exception traces
- lower the log level overall
- log twice, the second time at FINE with the exception
log.log(Level.WARNING, "IO Error rewriting image " +
request.toString() + "-" + ioe.getMessage());
log.log(Level.FINE, ioe);
- best of all, use log levels to decide whether to include the stack trace:
if (log.isLoggable(Level.FINE)) {
log.log(Level.WARNING, "IO Error rewriting image " +
request.toString(), ioe);
} else {
log.log(Level.WARNING, "IO Error rewriting image " +
request.toString() + "-" + ioe.getMessage());
}
... so anyone that needs to diagnose the exception has some recourse.
On Sun, Aug 2, 2009 at 11:40 PM, <li...@apache.org> wrote:
> Author: lindner
> Date: Mon Aug 3 06:40:55 2009
> New Revision: 800211
>
> URL: http://svn.apache.org/viewvc?rev=800211&view=rev
> Log:
> tamp down some exception logging. remove some hay from the haystack
>
> Modified:
> incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/image/BasicImageRewriter.java
>
> Modified: incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/image/BasicImageRewriter.java
> URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/image/BasicImageRewriter.java?rev=800211&r1=800210&r2=800211&view=diff
> ==============================================================================
> --- incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/image/BasicImageRewriter.java (original)
> +++ incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/image/BasicImageRewriter.java Mon Aug 3 06:40:55 2009
> @@ -201,13 +201,13 @@
> response = getOptimizer(response, imageFormat, image);
> totalRewrittenImageBytes.addAndGet(response.getContentLength());
> } catch (IOException ioe) {
> - log.log(Level.WARNING, "IO Error rewriting image " + request.toString(), ioe);
> + log.log(Level.WARNING, "IO Error rewriting image " + request.toString() + " - " + ioe.getMessage());
> } catch (RuntimeException re) {
> // This is safe to recover from and necessary because the ImageIO/Sanselan calls can
> // throw a very wide variety of exceptions
> log.log(Level.INFO, "Unknown error rewriting image " + request.toString(), re);
> } catch (ImageReadException ire) {
> - log.log(Level.INFO, "Failed to read image. Skipping " + request.toString(), ire);
> + log.log(Level.INFO, "Failed to read image. Skipping " + request.toString(), ire.getMessage());
> }
> return response;
> }
>
>
>