Yep. I should have thought of that. Thanks.
--- Josh Kewley <[EMAIL PROTECTED]> wrote:
> Just set base.File. Here's what I did:
>
> public class InsarioWebLogFileAppender :
> log4net.Appender.FileAppender
> {
> public override string File
> {
> get{return base.File;}
> set{base.File = Web.WebEnvironment.LogDirectory + value;}
> }
> }
>
> -----Original Message-----
> From: Ron Grabowski [mailto:[EMAIL PROTECTED]
> Sent: Friday, December 10, 2004 12:57 PM
> To: Log4NET User
> Subject: RE: Ability to use tilda (or relative path) when specifing
> output file in config file for ASP.Net logging
>
> FileAppender.cs in beta 8 contains this code:
>
> virtual public string File
> {
> get { return m_fileName; }
> set { m_fileName = ConvertToFullPath(value.Trim()); }
> }
>
> On line 132 of the same file I see this notation:
>
> override public void ActivateOptions()
> {
> base.ActivateOptions();
> if (m_fileName != null)
> ...
>
> Shouldn't the other methods in FileAppender.cs be accessing the
> public
> getter File instead of the private variable m_fileName in case
> someone
> extends the class?
>
> override public void ActivateOptions()
> {
> base.ActivateOptions();
> if (File != null)
> ...
>
> I was going to override the public File property in my own class that
> extends the built in FileAppender to add support for the tilda (sorry
> for the lack of formatting):
>
> namespace AspNetAppenders
> {
> public class FileAppender : log4net.Appender.FileAppender
> {
> private string m_aspNetfileName = null;
> override public string File
> {
> get { return m_aspNetfileName; }
> set
> {
> if (HttpContext.Current != null)
> {
> // TODO: handle case when tilda is already present
> m_aspNetfileName = HttpContext.Current.Server.MapPath("~" +
> value.Trim());
> }
> else
> {
> throw new
> System.Configuration.ConfigurationException("HttpContext.Current is
> null");
> }
> }
> }
> }
> }
>
> I don't think I can do that if the base FileAppender class refers to
> its own private m_fileName.
>
> - Ron
>
> --- Nicko Cadell <[EMAIL PROTECTED]> wrote:
>
> > In log4net 1.2 beta 8 it is not possible to parameterise the File
> > path
> > directly. It is possible to extend the FileAppender and override
> the
> > File property to add support for the ASP.NET "~" syntax.
>
>