Need to change the log4net configuration so log can be writtern in 
environmental variables
------------------------------------------------------------------------------------------

                 Key: LOG4NET-309
                 URL: https://issues.apache.org/jira/browse/LOG4NET-309
             Project: Log4net
          Issue Type: Bug
          Components: Other
    Affects Versions: 1.2.10
         Environment: Visual Studio 2010 - .Net 4.0
            Reporter: Yasir Chaudhry
             Fix For: 1.2.10


Hi,
I have to move logging from currently structure to app data --> roaming. I have 
went through couple articles to update the config files and added new class but 
it didn't work. Here is what i have so far..

Config file :-

    <appender name="LogFileAppender" type="log4net.Appender.FileAppender">
      <layout type="log4net.Layout.XMLLayout" /> -->
      
      
      <file type="log4net.Util.PatternString">
        <converter>
          <name value="folder" />
          <type
      value="TestApp.SpecialFolderPatternConverter,TestApp" />
        </converter>
        <conversionPattern value="%folder{appdata}\Company\log-file.log" />
      </file>

      <param name="AppendToFile" value="true" />
      <layout type="log4net.Layout.PatternLayout">
        <header type="log4net.Util.PatternString" value="[START LOG] %newline" 
/>
        <footer type="log4net.Util.PatternString" value="[END LOG] %newline" />
        <!--<conversionPattern value="%d [%t] %-5p - %m%n " />-->
        <conversionPattern value="%d [%t] - %m%n " />
      </layout>
    </appender>

In the Code :-

Public Class SpecialFolderPatternConverter
    Inherits log4net.Util.PatternConverter
    Protected Overrides Sub Convert(ByVal writer As System.IO.TextWriter, ByVal 
state As Object)
        Dim specialFolder As Environment.SpecialFolder = 
DirectCast([Enum].Parse(GetType(Environment.SpecialFolder), MyBase.[Option], 
True), Environment.SpecialFolder)
        writer.Write(Environment.GetFolderPath(specialFolder))
    End Sub
End Class

Any help to resolve this issue would highly appreciated.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to