Skip to content

Instantly share code, notes, and snippets.

@RhysC
Created January 13, 2014 02:14
Show Gist options
  • Save RhysC/8393620 to your computer and use it in GitHub Desktop.
Save RhysC/8393620 to your computer and use it in GitHub Desktop.
get the warn and errors for the azure emulator log file (assuming pretty std log4net set up)
function Get-AzureEmulatorErrors
{
$LocalApplicationDataPath = [Environment]::GetFolderPath([System.Environment+SpecialFolder]::LocalApplicationData)
$AzureResourceRoot = "$LocalApplicationDataPath\dftmp\Resources"
Write-Host "Local Azure Resource Root: $AzureResourceRoot"
pushd "$AzureResourceRoot"
$logs = (dir -Recurse *\directory\LoggingStorage\*.log)
$ErrorAndWarnLines = $logs | Select-String -pattern "\[ERROR\]|\[WARN \]"
$entries = $ErrorAndWarnLines | select LineNumber, `
Line, `
@{Name="Path";Expression={$_.RelativePath($AzureResourceRoot)}}, `
@{Name="Level";Expression={$_.Line.Substring(1,5)}}, `
@{Name="Project";Expression={$_.Path.Split('\')[-1].Split('.')[0]}}
popd
return $entries
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment