In Log4j 1.2 a Category was the base class for a Logger. So this would simply 
be 
looking for all the Appenders attached to the Logger. If a Category/Logger has 
no 
Appenders then it searches the parent hierarchy until it finds one. Note that 
even 
if it finds one if the Logger is configured as additive (the default) then the 
event will 
also be passed to the Logger’s parents. 

I haven’t looked at the code recently but I’d bet getAllAppenders only returns 
the 
Appenders directly attached to the Logger/Category.

Ralph

> On Aug 23, 2022, at 1:15 PM, Joel Griffith <jgrif...@nd.edu> wrote:
> 
> 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>
>> 


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org

Reply via email to