The problem is not in your configuration, but in how Lucee’s ResourceAppender interacts with Log4j2’s PatternLayout.
Null Header: When you specify "layout": "pattern", Lucee correctly creates a PatternLayout instance. By default, this layout does not have a header, so its getHeader() method returns null.
String header = new String(getLayout().getHeader(), charset);
When getLayout().getHeader() returns null, this line becomes new String(null, charset), which causes the NullPointerException you are seeing. The appender does not correctly handle a layout that has no header.
Because Lucee’s configuration mechanism doesn’t provide a way to add a header to the PatternLayout, you cannot work around this bug while still using the "pattern" layout with the "resource" appender.