HTML5 Canvas
Written by: Simon Sarris
Featured Refcardz: Top Refcardz:
  1. Apache Hadoop
  2. Web Driver
  3. MVVM
  4. REST
  5. ADO.NET
  1. HTML5
  2. Ajax
  3. jQuery Selectors
  4. CSS Part 1
  5. Git

Link Details

Link 114171 thumbnail
User 160465 avatar

By angsuman
via blog.taragana.com
Published: Sep 15 2008 / 04:44

A simple but invaluable java function for debugging.
  • 14
  • 2
  • 4182
  • 2

Comments

Add your comment
User 111696 avatar

bloid replied ago:

0 votes Vote down Vote up Reply

ahhh...this old chestnut...

User 210175 avatar

jtheory replied ago:

0 votes Vote down Vote up Reply

Well, it's core Java.
But how come they aren't throwing an exception, catching it, writing the stack trace to a StringWriter, then parsing it for the line number? I thought that was the "classic" approach.

User 111696 avatar

bloid replied ago:

0 votes Vote down Vote up Reply

It is? I'd never heard of that one... Always build a stacktrace array, and look for the relevant item...

User 182508 avatar

gareth_western replied ago:

0 votes Vote down Vote up Reply

or you could use one of the well-established logging libraries, such as Log4J

User 160465 avatar

angsuman replied ago:

0 votes Vote down Vote up Reply

I like something simple. Log4J, unfortunately, is not simple.
,> But how come they aren't throwing an exception, catching it, writing the stack trace to a StringWriter, then parsing it for the line number?

None of them throws any exception. Try it out.

Add your comment


Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.