Discussion: LoggingUtils#prepareLogEvent should gracefully handle missing ApplicationContext

24 views
Skip to first unread message

Felix Scheinost

unread,
Jun 13, 2024, 9:57:04 AM6/13/24
to CAS Developer
Hi,

currently when using `CasAppender` it is difficult to troubleshoot issues the application has on startup.

When the application fails to start, likely something is going to log some hint about why the application failed to start.

The problem is, that `CasAppender` tries to fetch the `MessageSanitizer` from the `ApplicationContext on every log.

When something is logged after the application failed to start (likely some crucial information) that isn't possible. Instead a big long exception is printed that the application context isn't initialized yet.

Could `CasAppender` do a) handle gracefully a uninitialized ApplicationContext or b) cache the `MessageSanitizier` so that at least these logs to debug application startup failure get logged?

Currently when the application fails to start I manually have to switch from `CasAppender` to a regular appender to debug the issue.

Regards
Felix
Reply all
Reply to author
Forward
0 new messages