do NOT dump messages/exception stacks to stdout/stderr

John Mazzitelli jmazzite at redhat.com
Tue Feb 28 13:53:51 UTC 2012


+            } catch (JsonParseException e) {
+                e.printStackTrace();
+            } catch (JsonMappingException e) {
+                e.printStackTrace();
+            } catch (IOException e) {
+                e.printStackTrace();

I just saw a checkin to the JBossAS 7 plugin with the above code in it.

This is a gentle reminder - our code conventions in the PC and plugins
are strict - do NOT dump stuff via System.out, System.err OR
e.printStackTrace. I just had to fix something like this yesterday
because someone got a stack trace dumped on the agents console - I had
to go in and convert it to a log message so the exception stack wasn't
bombarding the user on the console. 

We want everything logged. This is for several reasons:

1) for support purposes, put the info in a log so we can see it later
2) for user friendliness, don't bombard the user on the agent console
with stack dumps and odd error messages (odd to the user)
3) if the agent is running as a service, those messages will go
unnoticed anyway

So, use a logger and log the exception, do not just simply print it to
stdout/stderr.



More information about the rhq-devel mailing list