jayluc2 opened a new issue, #191:
URL: https://github.com/apache/logging-log4net/issues/191
After updating from version 2.0.15 to 3.0.0, our logging isn't being
written. I've managed to isolate this to using GlobalContext properties within
the file name, although I suspect anywhere properties are used are also a
problem. I've boiled our code down to the minimal set needed to reproduce the
issue:
Program.cs:
static void Main(string[] args)
{
log4net.GlobalContext.Properties["mycustomusername"] = "me";
Configuration configuration =
ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
FileInfo logfile = new FileInfo(configuration.FilePath);
XmlConfigurator.ConfigureAndWatch(logfile);
var _log = log4net.LogManager.GetLogger(typeof(Program));
long value = 0;
while (true)
{
_log.Debug($"New value is: {value++}");
Thread.Sleep(1000);
}
}
App.Config:
<log4net>
<appender name="RollingAppender"
type="log4net.Appender.RollingFileAppender">
<file type="log4net.Util.PatternString"
value="f:\temp\%property{mycustomusername}TestAppLog.log"/>
<appendToFile value="true"/>
<preserveLogFileNameExtension value="true"/>
<rollingStyle value="Composite"/>
<datePattern value=".yyyyMMdd"/>
<maximumFileSize value="1KB"/>
<countDirection value="1"/>
<maxSizeRollBackups value="20"/>
<staticLogFileName value="false"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date %-5level [%thread] -
%message%newline"/>
</layout>
</appender>
<root>
<level value="DEBUG"/>
<appender-ref ref="RollingAppender"/>
</root>
</log4net>
This message appears in the console window:
log4net:WARN Unable to set property [file] on object
[log4net.Appender.RollingFileAppender] using value
[f:\temp\%property{mycustomusername}TestAppLog.log] (with acceptable conversion
types)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]