java - log4j1.7 -extra ,daily rolling and weekly zipping of files for archiving -


<appender name="debug_appender" class="org.apache.log4j.rolling.rollingfileappender"> <param name="threshold" value ="debug" /> <param name="append" value ="true" /> <param name="datepattern" value ="yyyy-mm-dd-hh-mm-ss" /> <param name="file" value="c:/cameldata/logs/mason-debug.log"/> <rollingpolicy class="org.apache.log4j.rolling.timebasedrollingpolicy"> <param name="filenamepattern" value="c:/cameldata/logs/mason-debug.%d{yyyymmdd.hhmm-ss}.log"/> <param name="filenamepattern" value="c:/cameldata/logs/mason-debug.%d{yyyy-mm-dd-hh-mm}.zip"/> <param name="timebasedtriggerpolicy" value="2"/> </rollingpolicy> <param name="maxfilesize" value ="5mb" /> <layout class="org.apache.log4j.patternlayout"> <param name="conversionpattern" value="%d{yyyy/mm/dd hh:mm:ss} [%-p] %c - %m%n" /> </layout> <filter class="org.apache.log4j.varia.stringmatchfilter"> <param name="stringtomatch" value="message in" /> <param name="acceptonmatch" value="false" /> </filter> <filter class="org.apache.log4j.varia.stringmatchfilter"> <param name="stringtomatch" value="message out" /> <param name="acceptonmatch" value="false" /> </filter> </appender>

i want use new functionality of log4j-extras allows me zip previous log files in timely manner. current functionality of project such creates daily log files. want add functionality of zipping files weekly can archived. problem if try zip them adding filenamepattern keeps writting logs in same file till end of week , zips logs in single file, while want create daily log file , end of week zip log files in single zip file. there solution problem?

any leads appreciated. have tried various combinations achieving requirement tried add 2 filenamepattern's in appender. in following image, have kept rolling time in seconds , minutes testing purpose. thanks.

enter image description here


Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -