Good day,
I've browsed several examples of log4j.xml config files and couldn't find the
answer I was looking for. Is there a way to configure loggers in the xml file so that
we can attach specific appenders to them?
something that would look a bit like:
<logger name=mypackage.mymodule.myclass>
<priority value="info"/>
<param name="additivityFlag" value="false"/>
<appender-ref ref="thespecificappenderforthislogger"/>
</logger>
without adding the appender's reference to the root logger. I know it can be done in a
.properties file and "in code" but those answer aren't meeting our needs. We would
like to somehow, get rid of the logger hierarchy and specify an appender to execute a
particular logging task.
Our config file would then have several appenders, some attached to the root logger
(such as console) and some others to specific loggers.
Upon instanciation of the logger such as
LogManager.getLogger(mypackage.mymodule.myclass.class.getName()) we would obtain the
configured logger and simply call it's log method.
Thanx in advance,
Flip