vorburger commented on a change in pull request #912:
URL: https://github.com/apache/fineract/pull/912#discussion_r428622215



##########
File path: README.md
##########
@@ -268,6 +268,13 @@ Governance and Policies
 documents the process through which you can become a committer in this project.
 
 
+Logging Guidelines
+------------------
+* Never, ever, use `System.out` and `System.err` or `printStackTrace()` 
anywhere, but `LOG.info()` or `LOG.error()` instead.
+* When catching exceptions, either rethrow them, or log them.  Either way, 
include the root cause by using `catch (SomeException e)` and then either 
`throw AnotherException("..details..", e)` or `LOG.error("...context...", e)`.
+* In tests, you'll typically never catch exceptions, but just propagate them, 
with `@Test void testXYZ() throws SomeException, AnotherException`...`, so that 
the test fails if the exception happens.  Unless you actually really want to 
test for the occurence of a problem - in that case, use [JUnit's 
Assert.assertThrows()](https://github.com/junit-team/junit4/wiki/Exception-testing)
 (but not `@Test(expected = SomeException.class)`).

Review comment:
       done - thanks for noticing




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to