The server log contains entries (especially for workflows) that are repeated several times. That complicates analysis of a problem and increases the file size. It would be beneficial if one accident was reported only once.
Exceptions in workflow should be logged only once. The logged exception should be also followed by a “workflow stack trace” which would show what workflows and steps were run.
@tvavrda Do we want to make sure the exceptions will be always logged only once in general, or do we just want to make sure the exceptions will not be logged multiple times inside of the workflow.
I think we should not log the exceptions multiple times in general. What is the benefit of logging the same exceptuion with the same stack trace multiple times? If we only remove the duplicate logging inside of the wokflows and there will be an exception while calling the DataService from a worklow the exception will be logged three times: 1. in the DataService, 2. In the workflow, 3. In the controller
In general yes, we should log an exception once. I found an interesting article that discusses this issue. Please also look at the discussion, there is an interesting point about different loggers. This would be nice to solve.
- logger - Error everything to file no. 1 (there we want to hide every duplicate)
- logger - Errors in a specific class to file no. 2 (if logger no. 1 already logs an error, it would not appear here but I want to see any error that occurred specifically in this class; of course we would again like to hide duplicate exceptions for this specific logger).
An interesting article: Ensuring an Error is Logged Only Once - CodeProject (see the discussion as well),
Note: branch “prevent-multiple-logging”