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 15:41:29 UTC
[jira] [Created] (LOG4NET-309) Need to change the log4net
configuration so log can be writtern in environmental variables
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
[jira] [Commented] (LOG4NET-309) Need to change the log4net
configuration so log can be writtern in environmental variables
Posted by "Yasir Chaudhry (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LOG4NET-309?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13091909#comment-13091909 ]
Yasir Chaudhry commented on LOG4NET-309:
----------------------------------------
Well i tried but it also didn't work..
> 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
[jira] [Commented] (LOG4NET-309) Need to change the log4net
configuration so log can be writtern in environmental variables
Posted by "Roy Chastain (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LOG4NET-309?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13091866#comment-13091866 ]
Roy Chastain commented on LOG4NET-309:
--------------------------------------
If you are asking for the ability to set the log file path from an environmental variable, that functionality already exists.
Use ${variablename} In your case it would be File value=${APPDATA}\\Company\\log-file.log
If that is not the functionality you are looking, please explain more.
> 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
[jira] [Commented] (LOG4NET-309) Need to change the log4net
configuration so log can be writtern in environmental variables
Posted by "Yasir Chaudhry (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LOG4NET-309?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13091911#comment-13091911 ]
Yasir Chaudhry commented on LOG4NET-309:
----------------------------------------
However following line worked.
%env{PROGRAMDATA}\company\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
[jira] [Closed] (LOG4NET-309) Need to change the log4net
configuration so log can be writtern in environmental variables
Posted by "Yasir Chaudhry (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LOG4NET-309?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Yasir Chaudhry closed LOG4NET-309.
----------------------------------
> 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
[jira] [Updated] (LOG4NET-309) Need to change the log4net
configuration so log can be writtern in environmental variables
Posted by "Yasir Chaudhry (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LOG4NET-309?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Yasir Chaudhry updated LOG4NET-309:
-----------------------------------
Description:
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.
was:
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.
> 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
[jira] [Resolved] (LOG4NET-309) Need to change the log4net
configuration so log can be writtern in environmental variables
Posted by "Yasir Chaudhry (JIRA)" <ji...@apache.org>.
[ 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