In addition to the other suggestions, you could do this:

public class TildaFileAppender : FileAppender
{
 public override string File
 {
  get
  { 
   return base.File; 
  }
  set
  { 
   // replace the tilda with whatever value you want
   base.File = value.Replace(
    "~", 
   AppDomain.CurrentDomain.SetupInformation.ApplicationBase); 
  }
 }
}

You can also register your own patterns. The "appSettings" pattern
would get a value from AppSettings:

 <file value="%appSettings{LogDirectory}/MyLogFile.log"/>

Or you could create a pattern that gets the logging directory some
other way:

 <file value="%loggingDir/MyLogFile.log"/>

--- Morten Andersen <[EMAIL PROTECTED]> wrote:

> Hi
> 
> It would have been grate to be able to configure the logging
> directory 
> for my application, for example, in a environment variable.
> 
> Before:
>             <file value="c:/LogFiles/log4net/MyLogFile.log"/>
> 
> After:
>             <file value="~/MyLogFile.log"/>
> 
> -- 
> 
> Best Regards
> *Morten Andersen*
> Developer
> Vianett AS <http://www.vianett.no/> | [EMAIL PROTECTED] 
> <mailto:[EMAIL PROTECTED]> | Office: +47 69 20 69 74 
> <callto://+4769206974> | Skype: mortander <callto://mortander>
> 
> 

Reply via email to