java - Log4j same log file multiple webapp versions -
i have 1 webapp deploy tomcat server twice (it has different versions, lets 1.0 , 2.0). webapp has log4j configured. jar files log4j located in web-inf/lib folder of webapp, while properties file logger read external configuration path. both webapps log information in same .log file , happening 1 (either 1.0 or 2.0) logging specified file, while other 1 logs nothing. kinda believe it's because how log4j initialized during webapp initialization, i'm not sure how make both 1.0 , 2.0 log same file. ideas? properties file:
log4j.rootlogger=debug, file log4j.additivity.applicationlog=false log4j.appender.console=org.apache.log4j.consoleappender log4j.appender.console.layout=org.apache.log4j.patternlayout log4j.appender.console.layout.conversionpattern=%d{yyyy-mm-dd hh:mm:ss,sss} %x [%p] [%c{1}.%m] %m%n log4j.appender.file=org.apache.log4j.rollingfileappender log4j.appender.file.file=/external/path/mylogfile.log log4j.appender.file.maxfilesize=50000kb log4j.appender.file.maxbackupindex=10 log4j.appender.file.layout=org.apache.log4j.patternlayout log4j.appender.file.layout.conversionpattern=%d{yyyy-mm-dd hh:mm:ss,sss} %x [%p] [%c{1}.%m] %m%n
le: using tomcat 7
le2: might because of rollingfileappender. second app seems continue write in .log.1 file while first 1 writes in new .log file
log4j supports socketappender (https://logging.apache.org/log4j/1.2/faq.html#a3.3) purpose. have both versions of app log socketappender, , configure simplesocketserver receive information , write log entries disk.
see log4j: how use socketappender? example.
Comments
Post a Comment