I'm still trying to parse some Log4j v1 code for the update, and I hit something I can't find.
The docs here: https://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/Category.html#getAllAppenders() say that the Logger.getAllAppenders() method "Get[s] the appenders contained in this category as an Enumeration." There is no definition of what it means for an appender to be "contained in" a category, however, so I'm unable to predict exactly what the method will return. As precisely as possible, what defines the set of appenders that are "contained in" a category like a logger? In particular, does a child logger contain appenders assigned to its parent? Does a parent logger contain appenders assigned to its child? Thanks, Joel On Tue, Aug 16, 2022 at 3:37 AM Markus Dimmerling <markus.dimmerl...@ppi.de> wrote: > > 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> >