Why printStackTrace is not recommended to use in oracle ATG. If anyone knows please tell me.
Thanks in advance.
Why printStackTrace is not recommended to use in oracle ATG. If anyone knows please tell me.
Thanks in advance.
Avoiding the use printStackTrace
is not just limited to ATG but should be applied to JAVA development in general. The SonarQube
validation rules explains it as follow:
Throwable.printStackTrace(...) prints a throwable and its stack trace to some stream. Loggers should be used instead to print throwables, as they have many advantages:
With the availability of logError
you are able to easily spool your error messages, not only to the standard dynamo.log
and error.log
but you can also see them in context of the rest of your application logs.
There is another SO question touching the same topic available here.