Call-Depth overflow with AddFilters function

Mar 4, 2009 at 6:08 AM
Anyone else experience a call depth overflow Exception when utilizing the AddFilters function ?
Coordinator
Mar 6, 2009 at 12:33 AM
Edited Mar 6, 2009 at 12:34 AM
Hi,
with which version of Powershell ?
With which instructions or scripts ?
Mar 6, 2009 at 4:46 AM
Batchman

Powershell V1 is what I am using .
I ran into the issue with Demo4 , it appears to hit the depth overflow when in executing the AddFiltres function.  In my case the call depth overflow limit is indicated as 100 while the funciton mentioned hits 102.  
When I comment out the filters funciton execution the demo works fine..
Coordinator
Mar 9, 2009 at 6:27 PM
It is a bug.
Please replace this function :
---
function global:New-LogStringFilter([log4net.Appender.AppenderSkeleton] $Appender,
                                    [String] $Regex,
                                    [String] $MatchStr,
                                    [Switch] $Inverse){
 #Filter on a string or a regular expression or both. 
  begin
  {
    function NewStringFilter([log4net.Appender.AppenderSkeleton] $Appender=$(Throw $LogDatas.Get("NecessaryParameter","New-LogStringFilter","Appender")),
                             [String] $Regex,
                             [String] $MatchStr,
                             [Switch] $Inverse){
       $SbProperties={
         $Filter.RegexToMatch =$RegEx
         $Filter.StringToMatch=$MatchStr
          #Inverse la condition du test du filtre
         if ($Inverse) {$Filter.AcceptOnMatch=$False }
       }
       Write-Debug "$($SbProperties)"
       $Filter=New-LogFilter log4net.Filter.StringMatchFilter $SbProperties
       $Filter
    }
  }
  process
  {
     if ($_)
     {  
        Write-Debug ("Process : {0}" -F $MyInvocation.InvocationName)
        NewStringFilter -Appender $_ -Reg $Regex -MatchStr $MatchStr -Inverse:$Inverse
        #One emit a filter object 
     }
  }
  end
  {
     if ($Appender)
      {
        Write-Debug ("End : {0}" -F $MyInvocation.InvocationName)
        NewStringFilter -Appender $Appender -Reg $Regex -MatchStr $MatchStr -Inverse:$Inverse
      }
  }
}
---
Thanks :-)
Mar 10, 2009 at 2:09 AM
It works ...great thanks.

Next I just need to figure out how to reference a config file ... I did not see an explicit reference In the Demo.

Coordinator
Mar 10, 2009 at 12:05 PM
Hi,
have you see the demo5.ps1 and demo5-1.ps1 ?

 #Load a configuration file
Set-LogXMLConfigurator "$Pwd\PSLogColor.App.Config"
... 
 #Load a configuration file with the "Watch" mode.
 # [log4net.Config.XmlConfigurator]::ConfigureAndWatch()
Set-LogXMLConfigurator "$Pwd\PSLogColor.App.Config" -Watch