Skip to content

Commit

Permalink
Added condition to check if logging is enabled to line 153
Browse files Browse the repository at this point in the history
This corrects a bug where an empty CSV log file is being created with no CSV column names.
  • Loading branch information
AllenCraigBarnard authored Jun 21, 2023
1 parent 90357a7 commit e8e4989
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions scom/opsgenie.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ else {
}

catch {
if ($enableLogging){Add-OpsgenieIntegrationLogEntry -logLevel "ERROR" -logMessage "Opsgenie intergration script has failed to POST SCOM alert details to the Opsgenie API: Exception Type='$($_.Exception.GetType().FullName)',Exception Message='$($_.Exception.Message)'"}
if ($enableLogging){Add-OpsgenieIntegrationLogEntry -logLevel "ERROR" -logMessage "Opsgenie integration script has failed to POST SCOM alert details to the Opsgenie API: Exception Type='$($_.Exception.GetType().FullName)',Exception Message='$($_.Exception.Message)'"}
}
}
write-output $IntegrationLogEntry | Out-File $logfile -Append
if ($enableLogging){write-output $IntegrationLogEntry | Out-File $logfile -Append}

0 comments on commit e8e4989

Please sign in to comment.