Dealing With Custom Layouts
In order for an appender to deal with custom layouts, you must use the layout methods when preparing to log your messages. Below is a simple example from the console appender of how to do this:
As you can see, all you need to do is have an if
statement that checks whether the appender has a custom layout or not and then assign the return of the layout as your message to log.