Logging usually serves two different purposes:
You can display the context of certain events.
Tools like Sentry group related events and facilitate user identification, etc., so that developers can find the cause of the error more quickly.
The logging records events for user-defined heuristics, for example for business analyses. These records can be used for reports or optimisation of the business goals and, if necessary, visualised.
What are the advantages of
The log file contains all available diagnostic information such as file name, path, function and line number.
All events are automatically available via the root logger unless they are explicitly filtered out.