add the following to you log4j.properties: " log4j.rootCategory=ALL, R1, R2 " to log all other events to both appenders/files or " log4j.logger.AbstractAnimal =ALL, R1, R2 " to log only the events of AbstractAnimal to both appenders/files
btw: > Note that the classes are in three difference packages i think currently all your classes are in the same (default)package otherwise the configuration for the loggers would have to be different... cheers patrick > -----Ursprüngliche Nachricht----- > Von: wolverine my [mailto:[EMAIL PROTECTED] > Gesendet: Freitag, 16. März 2007 10:30 > An: Log4J Users List > Betreff: How to log message from the parent class > > > Hi! > > I have the following Java classes: > > > abstract class AbstractAnimal { > > Logger logger = Logger.getLogger(AbstractAnimal.class); > > protected void something() { > logger.debug("animal is doing something"); > } > } > > class Dog extends AbstractAnimal { > > Logger logger = Logger.getLogger(Dog.class); > > protected void anything() { > logger.debug("dog is doing anything"); > something(); > } > } > > class Cat extends AbstractAnimal { > > Logger logger = Logger.getLogger(Cat.class); > > protected void nothing() { > logger.debug("cat is doing nothing"); > something(); > } > } > > > Note that the classes are in three difference packages > and the log4j.properties looks like the following: > > > log4j.logger.Dog=ALL, R1 > log4j.appender.R1=org.apache.log4j.DailyRollingFileAppender > log4j.appender.R1.File=dog.log > > log4j.logger.Dog=ALL, R2 > log4j.appender.R2=org.apache.log4j.DailyRollingFileAppender > log4j.appender.R2.File=cat.log > > > The above configuration only logs "dog is doing anything" to dog.log > and "cat is doing nothing" to cat.log. > > How can I configure Log4j so that it will also log "animal is doing > something" in both log files? > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
