> As for delaying creating the file, that can be accomplished just by
> specifying createOnDemand=“true”.
Keep in mind, that this is not true for parent folders. Parent folders will be
created on initialization even before createOnDemand. (At least for
RollingFileAppenders)
This was my workaround for that issue: A RoutingAppender wrapping the
RollingFileAppender and routing all logging to null until the value is not
empty anymore.
<Routing name="parent-folder-route">
<Routes pattern="$${ctx:parent.folder}">
<Route key="$${ctx:parent.folder}">
<Null name="dontlog"/>
</Route>
<Route>
<RollingFile name="logger"
fileName="${ctx: parent.folder}/Logging.log"
filePattern="${ctx: parent.folder}/Logging.log.%i"
createOnDemand="true">
...
</RollingFile>
</Route>
</Routes>
</Routing>