Kinook Software Forums

Kinook Software Forums (
-   [VBP] General Discussion (
-   -   Creating logfiles (

levelinfinity 03-06-2003 07:44 PM

Creating logfiles
Hello everyone.
Is there a way to assign the date & time to the
logfile name when doing builds?

I tried adding the macro DATETIME to the logfile name and it doesn't create the log file. For example the variable BUILD_DATETIME is set to %DATETIME%. The LOGFILE variable is set to %PROJDIR%\Results_%BUILD_DATETIME%.log. If I set the LOGFILE variable to %PROJDIR%\Results.log it creates the logfile Results.log.

I want to be able to differentiate between log files.
Date and Time seemed appropriate.


schmidt4hire 03-06-2003 07:47 PM

Warren, the %DATETIME% macro is expanding to include invalid filename characters.

If your example was run today at 1:25:42 PM, and %PROJDIR% evalulated to "C:\MyProject", the log filename would evaluate to "C:\MyProject\Results_1/7/2003 1:25:42 PM". The forward slashes (/) between the day/month/year and the colons (:) between the hour:minutes:seconds are all invalid filename characters.

When this happens, VBuild is likely getting a error when it tries to create the logfile and just forcibly continues, without any logging.

Try changing your project so that it automatically creates the BUILD_DATETIME macro as one of the first steps, and then set its value to something like this (using the square-bracket notation to run some VBScript code):
[ Year( Now ) & "_" & _
Month( Now ) & "_" & _
Day( Now ) & "_" & _
Hour( Now ) & "_" & _
Minute( Now ) ]

This would give your filename the value of "C:\MyProject\Results_2003_1_7_13_44". Granted, this is kinda gross, but it will work. You can fiddle more with VBScript if you want a better formatted filename. I couldn't see an easy way to format a number with leading zeroes.


Doug Schmidt | Software Developer (Inkjet MDA) | Tel: +1.604.451.2720 ext: 3190 | |

All times are GMT -5. The time now is 01:03 PM.

Copyright 1999-2019 Kinook Software, Inc.