Skip to content

Instantly share code, notes, and snippets.

@ploegert
Created June 17, 2014 14:44
Show Gist options
  • Select an option

  • Save ploegert/4b3db52fb5a4ac9468d2 to your computer and use it in GitHub Desktop.

Select an option

Save ploegert/4b3db52fb5a4ac9468d2 to your computer and use it in GitHub Desktop.
Setup Log4Net/Log4Posh
Write-Verbose -Verbose:$ShowVerbose "BEGIN: log4net configuration definition"
$log = New-Log4Posh -Configuration "C:\Program Files\WindowsPowerShell\Modules\poshcat\log4posh\log4net.config" -Dll "C:\Program Files\WindowsPowerShell\Modules\poshcat\log4posh\log4net.dll" -Verbose:$ShowVerbose
$location = [System.Net.Dns]::GetHostName()
[log4net.NDC]::Push($location);
$location = Split-Path (Split-Path $myInvocation.MyCommand.path) -Leaf
[log4net.NDC]::Push($location);
$Log = [log4net.LogManager]::GetLogger($Host.GetType())
Write-Verbose -Verbose:$ShowVerbose "END: log4net configuration definition"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment