Now there is a new error. Somehow, when the exception happens in our Java library, even though we, in theory, write to System.out.println(), I never see the Exception in the logs.
All I can think is that somewhere in the Java library there is an exception that we catch but we forget to do System.out.println(). Can anyone think of another explanation? On Sunday, November 1, 2015 at 5:10:19 PM UTC-5, Lawrence Krubner wrote: > > So, we eventually fixed this. There were 2 bugs that worked together to > make this a mystery. I had to guess at what the problems were, and fix them > blind, since I could not see the Exceptions. I am curious about why I was > not able to see the Exceptions. > > About this: > > > Exceptions are ALWAYS visible, the only way they get lost is > > the try/catch blocks you added in your code which effectively > > swallow and ignore them. > > But the Exceptions I dealt with were invisible. We have the Clojure app > set up to run via Supervisord and the conf has these lines: > > stderr_logfile=/var/log/nlph_stderr.log > stdout_logfile=/var/log/nlph_stdout.log > > So in 2 terminal windows I would: > > cd /var/log > > tail -f nlph_stdout.log > > And the same for nlph_stderr.log. > > So I was looking at the output in my terminal window. And I could see all > of our logging statements appear. And the code clearly got to the line > where the exception happens, but then the Exception never appeared in the > terminal. It was invisible. I assume the output of this: > > System.out.println(e.getMessage()); > > would appear in one of the files that I was tailing. But it never did. > > So I am wondering why the Exceptions were invisible? Why didn't the print > statements make it to the terminal? > > > > > On Saturday, October 31, 2015 at 6:56:23 AM UTC-4, Thomas Heller wrote: >> >> >>> What could we do to make the Exception visible, assuming there is one? >>> >>> >> Exceptions are ALWAYS visible, the only way they get lost is the >> try/catch blocks you added in your code which effectively swallow and >> ignore them. The JVM will not randomly lose an Exception, it is always code >> you write that decided to handle them in some way. If you do not know how >> to handle an exception do not catch it, printing its stacktrace and >> ignoring it is never a good idea. >> >> In your case since you say that the function never returns I'd put my >> guess on an infinite loop. There is no exception that gets lost, your code >> is just still running. If your JVM is running locally you can attach to it >> via jvisualvm [1] and get a quick overview of what the JVM is doing. If you >> look at the thread information you'll see if something is still running or >> dead-locked somehow. >> >> You can also use a debugger and step through the java code step by step. >> >> Also, consider coding against interfaces in java (eg. java.util.List and >> java.util.Map instead of java.util.Collection), it will save you tons of >> conversion calls. >> >> HTH >> /thomas >> >> [1] https://visualvm.java.net/ >> > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.