PDA

View Full Version : Log level for console vs. log file


raistlin
11-18-2014, 10:08 AM
Hi Kinook,

I have searched around in the forums to look for more information about how logging works and haven't found much concrete info about it.

In general, i read these 2 links below and still a little confused.
http://www.kinook.com/VisBuildPro/Manual/index.htm?buildlogging.htm
http://www.kinook.com/VisBuildPro/Manual/index.htm?outputuseropt.htm

Last week i started to mess around with logging by minimizing the amount of logs produced by the console with /loglevel and succeeded. However the side effects of it were loosing the ability to log to file. I log file by passing LOGFILE macro to child bld scripts.

Is there anywhere that specifically says, which loglevel will / will not log to file? Thanks.

kinook
11-18-2014, 11:18 AM
http://www.kinook.com/VisBuildPro/Manual/loglevelproperty.htm

raistlin
11-19-2014, 03:35 AM
Thanks. I used the link above for /loglevel. But how can i achieve /loglevel vbldLogLevelWarning + but still able to log with vbldLogLevelDetailed to LOGFILE?

kinook
11-19-2014, 08:13 AM
Set Tools | Application Options | Logging (More) | Log level to Detailed and specify /loglevel 1 when calling visbuildcmd.
http://www.kinook.com/VisBuildPro/Manual/loggingmoreopt.htm
http://www.kinook.com/VisBuildPro/Manual/consoleapp.htm

raistlin
11-21-2014, 06:01 AM
Thanks Kinook. This works but it requires me to parse /logfile _filename_.

visbuildcmd Test.bld /loglevel 1 /logfile Test.log

I wish to use the LOGFILE macro already defined in the bld script, also when i parse LOGFILE macro in the command line, but omitting the /logfile parameter:

visbuildcmd Test.bld /loglevel 1 LOGFILE=%PROJDIR%\BuildLogs\%PROJROOT%.log

Is it possible? Thanks.

kinook
11-21-2014, 06:59 AM
/logfile filename and LOGFILE=filename are equivalent. Both have the effect of defining a LOGFILE temporary macro which is available in the build.
http://www.kinook.com/VisBuildPro/Manual/buildlogging.htm
http://www.kinook.com/VisBuildPro/Manual/systemmacros.htm

raistlin
11-21-2014, 08:52 AM
According to my tests, these 2 command lines gives different results:

Does not produce log file:
c:\Builds\Source\BuildScripts>visbuildcmd Test.bld /mta /loglevel 0 /config VisBuildPro.config LOGFILE=%PROJROOT%.log /nologo
21-11-2014 14:23:32: Starting Build: 'c:\Builds\Source\BuildScripts\Test.bld'
21-11-2014 14:23:32: Building project step 'Project steps'...
21-11-2014 14:23:32: Building project step 'Log Message'...
LOGFILE=
21-11-2014 14:23:32: Build successfully completed (elapsed = 00:00:00).

Produces log file:
c:\Builds\Source\BuildScripts>visbuildcmd Test.bld /mta /loglevel 0 /config VisBuildPro.config /LOGFILE %PROJROOT%.log /nologo
21-11-2014 14:24:28: Starting Build: 'c:\Builds\Source\BuildScripts\Test.bld'
21-11-2014 14:24:28: Building project step 'Project steps'...
21-11-2014 14:24:28: Building project step 'Log Message'...
LOGFILE=c:\Builds\Source\BuildScripts\Test.log
21-11-2014 14:24:28: Build successfully completed (elapsed = 00:00:00).

VisBuildPro.config used:

<?xml version='1.0' encoding='utf-8'?>
<configuration>
<option name='BuildFailureStepsOnCancel'>0</option>
<option name='CaseSensitiveBuildRuleComparisons'>0</option>
<option name='ConvertOutputDoubleQuotes'>0</option>
<option name='DefaultScriptEngine'>VBScript</option>
<option name='DelLogFileOnBuild'>0</option>
<option name='DelTempMacrosAfterBuild'>1</option>
<option name='DelTempMacrosOnRebuild'>0</option>
<option name='EchoChainedConsoleOutput'>1</option>
<option name='EnvVarsInSystemMacros'>1</option>
<option name='EscapeSpecialCharactersInOutput'>1</option>
<option name='FailBuildWhenDoneIfStepsFailed'>0</option>
<option name='LogAllFailureStepOutput'>1</option>
<option name='LogBuildRuleEval'>1</option>
<option name='LogDefaultStepProperty'>0</option>
<option name='LogFilename'></option>
<option name='LogFormat'>Text</option>
<option name='LogLevel'>3</option>
<option name='PersistBuildStatus'>0</option>
<option name='ReevaluateAllBuildRules'>0</option>
<option name='SetProjectDirectory'>1</option>
<option name='StripLogLinefeedChar'>0</option>
<option name='TextLogSkippedSteps'>1</option>
<option name='TextLogStepEvents'>1</option>
<option name='TextLogStepNumbering'>0</option>
</configuration>


This was my question earlier, i prefer to use LOGFILE=%PROJROOT%.log macro which i can define it in the bld file instead of parsing /logfile %PROJROOT%.log.

kinook
11-21-2014, 09:46 AM
You found a bug. If the /loglevel parameter was specified and /logfile was not, the LOGFILE=value parameter was ignored and the LOGFILE macro set to an empty string instead. This is fixed in the latest download (VisBuildCmd.exe 8.7.0.3 in Help | About after installing). Sorry for not noticing the issue when you first posted. Thanks.

raistlin
11-24-2014, 05:01 AM
Thanks for the quickfix. I had it installed and it creates log files. Yay.

I have another question regarding the difference i see.

The logfile is generated at the script directory, c:\Builds\Source\BuildScripts:
c:\Builds\Source>visbuildcmd BuildScripts\Test.bld /mta /loglevel 0 /config BuildScripts\VisBuildPro.config LOGFILE=%PROJROOT%.log /nologo
24-11-2014 10:54:36: Starting Build: 'c:\Builds\Source\BuildScripts\Test.bld'
24-11-2014 10:54:36: Building project step 'Project steps'...
24-11-2014 10:54:36: Building project step 'Log Message'...
LOGFILE=Test.log
24-11-2014 10:54:36: Build successfully completed (elapsed = 00:00:00).


The logfile is generated at my current directory, c:\Builds\Source:
c:\Builds\Source>visbuildcmd BuildScripts\Test.bld /mta /loglevel 0 /config BuildScripts\VisBuildPro.config /LOGFILE %PROJROOT%.log /nologo
24-11-2014 10:55:12: Starting Build: 'c:\Builds\Source\BuildScripts\Test.bld'
24-11-2014 10:55:12: Building project step 'Project steps'...
24-11-2014 10:55:12: Building project step 'Log Message'...
LOGFILE=c:\Builds\Source\Test.log
24-11-2014 10:55:12: Build successfully completed (elapsed = 00:00:00).


Since you said LOGFILE macro and /logfile param are equivalent, the generated logfile path is a little inconsistent.

kinook
11-24-2014, 07:30 AM
True, they're not exactly equivalent. When LOGFILE=filename is used, the value provided is assigned to the macro value. When /logfile is used, it does convert relative paths (via the GetFullPathName (http://msdn.microsoft.com/en-us/library/windows/desktop/aa364963%28v=vs.85%29.aspx) API) as it also does for other file/path parameters (.bld filename, /configpath, etc.). It's probably best to specify an absolute path to remove any ambiguity (i.e., %PROJDIR% for the path of the .bld file, %~dp0 to use the calling command script's path, a hard-coded path, etc.).

raistlin
11-24-2014, 09:45 AM
Roger that. Thanks alot for the support!