In the moqui-framework log4j2.xml configuration file, an Async Appender is used which references multiple appenders. I was going through the Official Log4j documentation for implementing certain use case, the documentation says that -
The AsyncAppender should be configured after the appenders it references to allow it to shut down properly.
Reference: Log4j – Log4j 2 Appenders - Apache Log4j 2
In the moqui-framework’s log4j2 config file the Async Appender references the Console Appender but is placed before that -
<Async name="AsyncLog">
<AppenderRef ref="STDOUT"/>
<AppenderRef ref="LogFile"/>
<AppenderRef ref="ErrorFile"/>
<AppenderRef ref="MoquiSubscribers"/>
</Async>
<Console name="STDOUT" target="SYSTEM_OUT">
<PatternLayout pattern="%highlight{%d{HH:mm:ss.SSS} %5p %12.12t %38.38c{1.9.1.}} %m%n"/>
</Console>
Is there any specific reason why it is configured like this ?
Ideally the Async Appender should be placed at last.
Link to PR - Improved log4j2 configuration by AyanF · Pull Request #629 · moqui/moqui-framework · GitHub