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.
| 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. |
|
|
|
ActiveForums 3.7
|