I wrote a C # program that creates a log file and populates it with log4net. This program runs powershell scripts. Scripts also use log4net. He works:
> C#: > ps.Runspace.SessionStateProxy.SetVariable("myMethod",(Action<Level,string>)myMethod); > ps.AddCommand(System.IO.Path.Combine(pathScripts, testSkripte[i].ToString())); > ps.Invoke(); > Powershell: > $ScriptLog.Invoke([log4net.Core.Level]::Debug, "TestFile_Debug") > $ScriptLog.Invoke([log4net.Core.Level]::Warn, "TestFile_Warn") $ScriptLog > $ScriptLog.Invoke([log4net.Core.Level]::Error, "TestFile_Error")
Now I want to add use the standard Write-Error, Write-Debug, etc. CMDlets in my Script.
( looks here - Heineck's answer).
Powershell: Write-Warning "Write-Warning" AND Write-Error "Write-Error"
works, but the following does not work:
Write-Debug "Write-Debug" (I donΒ΄t get an item in my logfile) OR Write-Debug "Write-Debug" -debug (for this I get an item in my logfile, but ...)
... I also get an error in my log file. The error looks like this:
[2010-10-22 13:10:58,097] DEBUG : Write-Debug [2010-10-22 13:10:58,113] ERROR : Cannot invoke this function because the current host does not implement it
(I think all namespaces.)
What does the error message mean and what can I do again?
thanks
source share