logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Laurent Hasson" <...@CapsicoHealth.com>
Subject Questions about RollingFile
Date Thu, 19 May 2016 03:18:45 GMT


I have the following XML configuration file for my webapp (under Tomcat 9).


<?xml version="1.0" encoding="UTF-8"?>

<Configuration status="info">



              <Property name="now">${sys:startup}</Property>



              <RollingFile name="FILES" fileName="${log-path}/capsico.log"


                     <pattern>%d{MMdd.HHmmss.SSS}#%-3t %level{length=1}
%15.15c{1}|  %m%ex{20}%n</pattern>



                           <SizeBasedTriggeringPolicy size="100 MB" />


                     <DefaultRolloverStrategy max="99999"


              <Async name="ASYNC">

                     <AppenderRef ref="FILES" />




              <Root level="debug">

                     <AppenderRef ref="ASYNC" />





I have done one thing that I haven't seen in any example, which is that all
the logs are tagged with the timestamp of when the system started (using
${sys:startup}), rather than using an inline timestamp format. This allows
me to group all log files per "server startup". This works well. 


Now, I would like to do the same thing for the initial/starting file, and I
have tried fileName="${log-path}/capsico.${sys:startup}.log" but with no
success. I have also tried:

-          fileName="${log-path}/capsico.$${sys:startup}.log"

-          fileName="${log-path}/capsico.${now}.log"

-          fileName="${log-path}/capsico.$S{now}.log"


I find this easier to manage in development or when troubleshooting
deployment issues where the server may be re-started multiple times: instead
of having a single "start" file with all the logging appended across
multiple server restart, I would like to always get a new clean file


Can this be done? I am sure there is a way by writing some Java code and
all, but trying to figure out a config-level way first if available.


Thank you,


Laurent Hasson
Co-Founder and CTO

CapsicoHealth Inc.


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message