Friday, May 18, 2012
 
The best way to analyze your logs! Minimize
 Log4Net Mail archive   

The Log4Net mailing list is a great source of information about using log4Net, in this forum we collect all the messages in the log4net user list and some selected threads from the developer list.

Subject: ~/MyLogFile.txt
Prev Next
You are not authorized to post a reply.

Author Messages
Morten Andersen

03/24/2006 3:26 PM  

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/> | morten@vianett.no
<mailto:morten@vianett.no> | Office: +47 69 20 69 74
<callto://+4769206974> | Skype: mortander <callto://mortander>

Nicko Cadell

03/24/2006 5:42 PM  

To use an environment variable in your configuration file try:

<file
  type="log4net.Util.PatternString"
  value="%env{LOGGINGPATH}\log.txt"
/>

cheers,
Nicko

Michael Hinkel

03/24/2006 8:09 PM  

simply try:

<file value="${TMP}\myfile.log" />


Regards,
Michael

_______________________________________
DATATRAK Deutschland GmbH
Michael Hinkel
Software Developer
Rochusstrasse 65
53123 Bonn

Tel +49 (228) 97983-602
Fax +49 (228) 97983-34
Michael.Hinkel@datatrak.net
http://www.datatrak.net
 

Ron Grabowski

03/25/2006 1:59 AM  

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

You are not authorized to post a reply.
Forums > Log4Net > Log4Net Mail archive > ~/MyLogFile.txt



ActiveForums 3.7

 

 

 

 

 

 

 

 

Log4Net Dashboard

Log analysis and monitoring made easy!

Log4Net Dashboard is a log viewer that can read log statements from a variety of logging output targets.

You can download a free developer version.

  

Check it out!

On the demonstration site you can try it  with live data.demo.l4ndash.com - Try Log4Net Dashboard with live data

The mail archive is a copy of all the mail sent to the mail address: log4net-user@logging.apache.org, organized as a forum.

If you would like to participate in the mail list, send a mail to log4net-user-subscribe@logging.apache.org.

More information about the mailing list is available on: http://logging.apache.org/log4net/support.html

 

A complete topic list is available and can be viewed here (warning, it takes some time to load)

 

Copyright 2005-2008 by FaktNet AS Terms Of Use Privacy Statement