You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-dev@logging.apache.org by "Yasir Chaudhry (JIRA)" <ji...@apache.org> on 2011/08/26 20:03:33 UTC

[jira] [Resolved] (LOG4NET-309) Need to change the log4net configuration so log can be writtern in environmental variables

     [ https://issues.apache.org/jira/browse/LOG4NET-309?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Yasir Chaudhry resolved LOG4NET-309.
------------------------------------

    Resolution: Fixed

Issue is fixed with by adding following line in configuration file:
%env{PROGRAMDATA}\AMCAD\file.log

> 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 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