-
Notifications
You must be signed in to change notification settings - Fork 0
One Log
The central factory implements a singleton pattern: Once created, the factory will keep the instance of the log writer until its owner explicitly destroys it. Subsequent calls to the factory will return that singleton instance even if a log writer for a totally different log object was requested.
This might seem odd at first, but it has been implemented like that for two reasons.
When integrating the logging API into a legacy application, it would be almost impossible to extend each and every method interface, so that the new log writer could be passed down the entire call chain.
An easier solution was needed and a factory, that simply keeps the instance for later use makes it pretty easy to reuse the same log writer instance all the way down the call chain.
The second and even more important reason was, that we wanted to make support easier.
Your application might use another component directly or indirectly. If an error occurs in that component, it will affect your application. So in the end you will receive a ticket because your application is not working as expected.
In such cases the used component must log under the log of your application. Otherwise it could be very difficult to even find the relevant logs, e.g. for BAdI implementations. For this reason the API enforces the use of exactly one log writer instance.
This way, the developer handling the ticket will receive all relevant log messages.