You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by vo...@apache.org on 2020/05/19 21:28:12 UTC

[fineract] branch vorburger-README-LoggingGuidelines created (now 25dff61)

This is an automated email from the ASF dual-hosted git repository.

vorburger pushed a change to branch vorburger-README-LoggingGuidelines
in repository https://gitbox.apache.org/repos/asf/fineract.git.


      at 25dff61   add new Logging Guidelines section to README (re. FINERACT-942)

This branch includes the following new commits:

     new 25dff61   add new Logging Guidelines section to README (re. FINERACT-942)

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[fineract] 01/01: add new Logging Guidelines section to README (re. FINERACT-942)

Posted by vo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

vorburger pushed a commit to branch vorburger-README-LoggingGuidelines
in repository https://gitbox.apache.org/repos/asf/fineract.git

commit 25dff61af692d35914131148c1def345985214aa
Author: Michael Vorburger ⛑️ <mi...@vorburger.ch>
AuthorDate: Tue May 19 23:28:04 2020 +0200

     add new Logging Guidelines section to README (re. FINERACT-942)
---
 README.md | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/README.md b/README.md
index bdffaf0..3faa503 100644
--- a/README.md
+++ b/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)`).
+* Never catch `NullPointerException` & Co.
+
 Pull Requests
 -------------