I “guess” I’m getting closer, I did this in my custom module:
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<appender name="INITIALIZER_LOGFILE_APPENDER" class="org.apache.log4j.RollingFileAppender">
<param name="append" value="false"/>
<param name="file" value="initializer.log"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%p - %C{1}.%M(%L) |%d{ISO8601}| %m%n" />
</layout>
</appender>
<logger name="org.openmrs.module.initializer" additivity="false">
<level value="INFO"/>
<appender-ref ref="INITIALIZER_LOGFILE_APPENDER"/>
</logger>
<root>
<appender-ref ref="INITIALIZER_LOGFILE_APPENDER"/>
</root>
</log4j:configuration>
Things seem to work fine (based on what I observe within tests). However at runtime the log file is nowhere to be found… I was taking the inspiration from this line:
<param name="file" value="openmrs.log"/>
Of course I could provide a path such as /opt/openmrs/initializer.log but this would make me bump into access rights issues. What would be the way to specify a path inside the app data dir?