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 "zsu (JIRA)" <ji...@apache.org> on 2010/03/29 02:47:27 UTC

[jira] Commented: (LOG4NET-219) RollingFileAppender with varying dynamic filenames not working

    [ https://issues.apache.org/jira/browse/LOG4NET-219?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12850762#action_12850762 ] 

zsu commented on LOG4NET-219:
-----------------------------

Check out the RollingPatternFileAppender at http://mysite.verizon.net/vze14bhji/RollingPatternFileAppender.htm.
It can create log file with dynamic name and has all the rolling feature like RollingFileAppender.

> RollingFileAppender with varying dynamic filenames not working
> --------------------------------------------------------------
>
>                 Key: LOG4NET-219
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-219
>             Project: Log4net
>          Issue Type: Bug
>          Components: Appenders
>    Affects Versions: 1.2.10
>         Environment: OS: Windows Server 2003, Sharepoint 2007
>            Reporter: Amar G
>         Attachments: log4netinternaldebug.txt
>
>
> The Log4Net configuration file is as below:
> <log4net>
> 		<appender name="RollingFile" type="log4net.Appender.RollingFileAppender">
> 			<file type="log4net.Util.PatternString" value="C:\ErrorLog\%property{LogPath}"></file>
> 			<appendToFile value="true"></appendToFile>
> 			<maximumFileSize value="1024KB"></maximumFileSize>
> 			<maxSizeRollBackups value="2"></maxSizeRollBackups>
> 			<layout type="log4net.Layout.PatternLayout">
> 				<conversionpattern value="%newline%date - %message%newline"></conversionpattern>
> 			</layout>
> 		</appender>
> 	                     <logger name="File">
> 			<level value="All" />
> 			<appender-ref ref="RollingFile" />
> 		</logger>
> 	</log4net>
> In my application the debug method for logging the information will be called many times. Some messages should get stored in a file with name say xy.log and some messages should get stored in a file with name say ab.log.
> In Global.asax i have written the following code:
> log4net.Config.XmlConfigurator.ConfigureAndWatch(new System.IO.FileInfo(Server.MapPath("/Log4Net.config")));
> The above LOC is written in the Application_Start event
> Actual call to the debug method:
>  log4net.GlobalContext.Properties["LogPath"] = String.Concat(FilePrefix,"_Debug.log");
>             log4net.ILog filelogger = log4net.LogManager.GetLogger("File");
>             filelogger.Debug(info);
> Issue: Although the property named LogPath is getting set properly, i dont see any file with the name specified through the code getting created in the path specified.
> Can you please look into this and let me know whether i am missing something or whether it is not supported?
> Thanks in advance.....

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.