dimanche 28 septembre 2014

log4net properties set from code not used in log.conf


Vote count:

0




I am trying to configure a log4net appender to write the log file to the users application data in subfolder.


I tried the following config + code:



<appender name="LogFileAppender" type="log4net.Appender.RollingFileAppender">
<file value="${APPDATA}/%property{LogName}/Logging/log.txt" />


and before I configure log4net in code, I set the property.



GlobalContext.Properties["LogName"] = "TV Show Manager";
log4net.Config.XmlConfigurator.Configure(new FileInfo(path));


If I replace %property{LogName} with the hard coded string 'TV Show Manager', it works fine.


What did I do wrong?



asked 29 secs ago

bas

3,712






log4net properties set from code not used in log.conf

Aucun commentaire:

Enregistrer un commentaire