asepaprianto / crawler4j

Automatically exported from code.google.com/p/crawler4j
0 stars 0 forks source link

Cathing any exception and hidding the log. #284

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
In the webcrawler.java line 363 (v3.6-SNAPSHOT) are a try-catch that will catch 
any exception executed in this methods (and any overrided method) and only a 
small message is shown that makes it very difficult to debug. Probably it would 
be better to show the entire error or throw the exception to allow the user to 
handle it. 

Original issue reported on code.google.com by jorgehor...@gmail.com on 19 Aug 2014 at 7:08

GoogleCodeExporter commented 9 years ago
I think you don't have the latest version from trunk so the line numbers are 
different.

Please point me to the line number in the following URL:
https://code.google.com/p/crawler4j/source/browse/src/main/java/edu/uci/ics/craw
ler4j/crawler/WebCrawler.java

Original comment by avrah...@gmail.com on 19 Aug 2014 at 7:27

GoogleCodeExporter commented 9 years ago
Yes seems that I have a different code, in this version is line 391.

Original comment by jorgehor...@gmail.com on 19 Aug 2014 at 7:38

GoogleCodeExporter commented 9 years ago
Ok, no problem, more logging is good as long as it is done using the right 
tools.

I will throw the whole stacktrace.

Just so I don't lose the line again it is line:
logger.error("Exception while running the visit method. Message: '{}' at {}", 
e.getMessage(), e.getStackTrace()[0]);

By the way, did you encounter a scenario where you met this line ?
If yes, then I will like to see the scenario so I can debug it...

Original comment by avrah...@gmail.com on 19 Aug 2014 at 7:41

GoogleCodeExporter commented 9 years ago
Probably would be better to get the entire stacktrace in the logger. The 
scenario I have found depends entirely on my code, I have had an exception 
(Hibernate exception) when overriding the function 'public boolean 
shouldVisit(WebURL url)'. This error is my fault, not yours. But it was very 
hard to find due to the error was masked. 

Original comment by jorgehor...@gmail.com on 19 Aug 2014 at 7:48

GoogleCodeExporter commented 9 years ago
I see.

I will upgrade the logs, this is a high priority for me.

Original comment by avrah...@gmail.com on 19 Aug 2014 at 7:49

GoogleCodeExporter commented 9 years ago
Thanks for your dedication. 

Original comment by jorgehor...@gmail.com on 19 Aug 2014 at 7:56

GoogleCodeExporter commented 9 years ago
Fixed.

Upgraded the logging in that specific place.
Upgraded the logging for unexpected errors
Clarified a little status code 1005

Fix done in revision hash: 8e0bdb83ab2b 

Original comment by avrah...@gmail.com on 19 Aug 2014 at 9:28