Java Lombok log4j use different appender -
how use different appender in 1 class lombok.
i tried
@log4j(topic = "myappender") @service("myservice") public class demoserviceimpl implements demoservice { ... }
and log4j configuration
log4j.rootlogger=info, myconsoleappender # settings console appender log4j.appender.myconsoleappender=org.apache.log4j.consoleappender log4j.appender.myconsoleappender.layout=org.apache.log4j.patternlayout log4j.appender.myconsoleappender.layout.conversionpattern=%-4r [%t] %-5p %c %x - %m%n # settings file appender log4j.appender.myappender=org.apache.log4j.fileappender log4j.appender.myappender.file=mylog.log log4j.appender.myappender.layout=org.apache.log4j.patternlayout log4j.appender.myappender.layout.conversionpattern=[%p] %d{date} %m%n
so want log in myconsoleappender logs in demoserviceimpl class want save file - use myapppender log4j properties file.
i resolved myself
adding log4j properties
log4j.category.myappednerlogger=info, myappedner log4j.additivity.myappednerlogger=false
and log4j anontation correction
@log4j(topic = "myappednerlogger") @service("myservice") public class demoserviceimpl implements demoservice { ... }
Comments
Post a Comment