Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gh 109 make sure that the min level of the file logger (n log) for install tool is set to the required value #110

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions Source/Server/Install/Install-ISHDeployment.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,15 @@ $newParameterScriptBlock={
}

$logLevelScriptBlock={
$major=($ISHVersion -split '\.')[0]
if($major -ge 14)
{
$requiredLevel="Info"
}
else
{
$requiredLevel="Debug"
}
$installToolNlogPath=Join-Path $CDPath "__InstallTool\NLog.config"
Write-Debug "installToolNlogPath=$installToolNlogPath"

Expand All @@ -336,13 +345,17 @@ $logLevelScriptBlock={
$xpathFileLoggerRule='ns:nlog/ns:rules/ns:logger[@writeTo="File"]'
$nodeFileLoggerRule=$xml.SelectSingleNode($xpathFileLoggerRule, $nsmgr)

if ($nodeFileLoggerRule.minLevel -ne "Debug")
if ($nodeFileLoggerRule.minLevel -ne $requiredLevel)
{
Write-Warning "Changing the minLevel attribute of the File logger from '$($nodeFileLoggerRule.minLevel)' to 'Debug'"
Write-Warning "Changing the minLevel attribute of the File logger from '$($nodeFileLoggerRule.minLevel)' to '$($requiredLevel)'"
$nodeFileLoggerRule.minLevel="Debug"
$xml.Save($installToolNlogPath)
Write-Verbose "Saved to $installToolNlogPath"
}
else
{
Write-Warning "The minLevel attribute of the File logger is already set to '$($requiredLevel)'"
}
}

$installScriptBlock={
Expand Down Expand Up @@ -386,7 +399,7 @@ try
Invoke-CommandWrap -ComputerName $Computer -Credential $Credential -ScriptBlock $newParameterScriptBlock -BlockName $blockName -UseParameters @("cdPath","ISHVersion","OSUserCredential","ConnectionString","IsOracle","Name","RootPath","LucenePort","UseRelativePaths")
$blockName="Making sure that the minLevel of the File logger is set to 'Debug' for InstallTool"
Write-Progress @scriptProgress -Status $blockName
Invoke-CommandWrap -ComputerName $Computer -Credential $Credential -ScriptBlock $logLevelScriptBlock -BlockName $blockName -UseParameters @("cdPath")
Invoke-CommandWrap -ComputerName $Computer -Credential $Credential -ScriptBlock $logLevelScriptBlock -BlockName $blockName -UseParameters @("cdPath","ISHVersion")

$blockName="Installing $Name"
Write-Progress @scriptProgress -Status $blockName
Expand Down