Hi,

I've created a log4j appender (by extending AppenderSkeleton) which uses a
component that depends on log4j. Naturally when I set log4j to use this
appender I get a circular dependency, because log4j needs the appender that
needs the component that needs the log4j that needs........... stack
overflow!

Component -----> log4j -----> Appender ----.
    ↑                                      |
    └--------------------------------------'

I can fix that issue just by instructing log4j (set threshold OFF for the
packages that contain logged classes in the component) to ignore the
component's classes that use log4j. Works, but it pollutes and adds
unnecessary complexity to the configuration file, moreover this is risky --
other programmers may not be aware of the circular dependency and will take
ages to figure out what is causing the problem.

To me, changing the logging logic in the component sounds good, but I don't
know exactly how to do that. Is there a way to specify which
appenders appenders used by the Logger instances in the component?


Thanks,
Ivan Z. Alencar

Reply via email to