> > The quirky thing about this is that because log4cxx doesn't actually
> > care about the Java class name, the following lines in the config file
> > are all equivalent:
> > <appender name="ROLL"
> > class="org.apache.log4j.rolling.RollingFileAppender">
> > <appender name="ROLL" class="RollingFileAppender">
> > <appender name="ROLL" class="log4cxx.RollingFileAppender">
>
> I don't get your point: The second and third line could be used to
> address the wrong RollingFileAppender currently, the obsolete one?
> Looking at the class loader, the absolute name is preferred, so NOT
> using those names for appenders could easily be considered a user
> error or docs would need to be made more clear.
>

All of those configuration lines load the correct version of
RollingFileAppender.  The meta-data about the class(in the
DECLARE_LOG4CXX_OBJECT macro) contains the class name.  For the
non-obsolete version, the class name is simply "RollingFileAppender".
The obsolete version is defined here:
https://github.com/apache/logging-log4cxx/blob/79352bd0160866d06b61414f2dc83d1f71b44335/src/main/cpp/obsoleterollingfileappender.cpp#L40

If the exact class name isn't found, then the code simply looks at
everything beyond the last '.' to load the class:
https://github.com/apache/logging-log4cxx/blob/79352bd0160866d06b61414f2dc83d1f71b44335/src/main/cpp/class.cpp#L123
Since all of the examples that I gave end in 'RollingFileAppender' and
they don't equal "org.apache.log4j.RollingFileAppender", the correct
RollingFileAppender is used.

-Robert Middleton

Reply via email to