Question

I know how to set different log files for different packages in log4j.properties file, but I want to set them programmatically.

For Example, how can I manage this configuration programmatically?

log4j.appender.MyAppeder=org.apache.log4j.RollingFileAppender
log4j.appender.MyAppeder.File=${log}/mylog.log
log4j.appender.MyAppeder.layout=org.apache.log4j.PatternLayout
log4j.appender.MyAppeder.layout.ConversionPattern=%p %t %c - %m%n
log4j.logger.com.mypackage=DEBUG,MyAppeder

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top