Re: [Quickfix-developers] Datestamp in Log File names
Brought to you by:
orenmnero
|
From: Andrew M. <an...@nm...> - 2006-08-15 15:15:22
|
>Is there any way to have the log files date stamped? The log files
>for our Price feed can get in excess of 100MB per day. We would like
>to have separate log files for each day so that we can clean up on a
>regular basis.
Does your application stop each night? I'm doing something like this in
the batch file that starts my app daily... You could do something similar
in fewer lines if you're not running windows...
REM assign d to date without time
for /f "tokens=1,2" %%u in ('date /t') do set d=%%v
REM strip off century from year
set timestr=%d:~6,4%%d:~3,2%%d:~0,2%
for %%F in (store_prod) do (
for /F %%D in ("%%~tF") do (
set mdate=%%D
)
)
for /F "tokens=2" %%D in ('date/t') do set cdate=%%D
REM ---THIS IS NEEDED ON WIN2K TO STRIP 2003 DOWN TO 03.
for /f "tokens=3" %%q in ('ver') do set x=%%q
rem if "%x%"=="XP" GOTO XP
rem set cdate=%cdate:~0,6%%cdate:~8,2%
:XP
for /F "tokens=1,2,3 delims=: " %%i in ('time /t') do set q=%%i%%j%%k
set datetime=%timestr%_%q%
ren c:\oms\oms.log oms_log.%datetime%
if "%cdate%"=="%mdate%" GOTO OK
echo "OMS being run for first time today - resetting store"
mkdir c:\oms\store_prod_%timestr%
move c:\oms\store_prod\*.* c:\oms\store_prod_%timestr%
del /Q c:\oms\store_prod
:OK
..start your application
|