Wouldn't it make sense to use a header and/or footer for logging that start and/or end time? Though encoding it in the file name makes sense.
On 24 February 2018 at 21:02, Ralph Goers <[email protected]> wrote: > ${xxx:nnn) is the general format for Lookups. ${date:} is the date Lookup. > It returns the current date, which is exactly what you wanted. > > Ralph > > > On Feb 24, 2018, at 5:05 PM, Laurent Hasson <[email protected]> > wrote: > > > > Oh yes, apologies... I did some edits to simplify my config file and > accidentally changed $ to %. It is correct in the file. I tried > ${date:yyyy-MM-dd} and it works. I'll read up on what "date:" is. > > > > Thank you, > > Laurent > > > > -----Original Message----- > > From: Ralph Goers [mailto:[email protected]] > > Sent: Saturday, February 24, 2018 18:41 > > To: Log4J Users List <[email protected]> > > Subject: Re: Parametrizing file names with start date of process > > > > First, you are referring to the variable as %{now} when it should be > ${now}. Second, all that is going to do is replace ${now} in the file name > with %d{yyyy-MM-dd} which will then be resolved when the file is created. > > > > I would suggest defining now as ${date:yyyy-MM-dd} > > > > Ralph > > > >> On Feb 24, 2018, at 12:13 PM, Laurent Hasson <[email protected]> > wrote: > >> > >> Hello, > >> > >> I'd like to parametrize my log file names with the start date of the > process. This makes it easier for us to see after the facts in the logs if > a server was restarted etc... > >> > >> The approach I took was the following: > >> <Properties> > >> <Property > >> name="log-path">C:\CAPSICO\_Stand_Alone_Runtime_\logs\</Property> > >> <Property name="now">%d{yyyy-MM-dd}</Property> > >> </Properties> > >> <Appenders> > >> <RollingFile name="FILES" fileName="${log-path}/capsico.%{now}.log" > filePattern="${log-path}/capsico. %{now}.%i.log.gz"> > >> <PatternLayout> > >> <pattern>%d{MMdd.HHmmss.SSS}#%-3t %level{length=1} %15.15c{1}| > %m%ex{20}%n</pattern> > >> </PatternLayout> > >> <Policies> > >> <SizeBasedTriggeringPolicy size="100 MB" /> > >> </Policies> > >> <DefaultRolloverStrategy max="99999" compressionLevel="9"/> > >> </RollingFile> </Appenders> > >> > >> My thinking is that ${now} would be resolved when the system starts, > and then I could use the value in the file names. But the filenames print > '${now}' directly. > >> > >> Any help would be much appreciated. > >> > >> Thank you, > >> Laurent. > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [email protected] > > For additional commands, e-mail: [email protected] > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [email protected] > > For additional commands, e-mail: [email protected] > > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > -- Matt Sicker <[email protected]>
