-
-
Notifications
You must be signed in to change notification settings - Fork 337
Closed
Description
I just updated from v3.0.4 to 3.1.0 and suddenly logging fails with an ArgumentException ("The path is not of a legal form.")
Stack:
at System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths)
at System.IO.Path.InternalGetDirectoryName(String path)
at log4net.Appender.RollingFileAppender.InitializeFromOneFile(String baseFile, String curFileName)
at log4net.Appender.RollingFileAppender.InitializeRollBackups(String baseFile, IList`1 arrayFiles)
at log4net.Appender.RollingFileAppender.DetermineCurSizeRollBackups()
at log4net.Appender.RollingFileAppender.ExistingInit()
at log4net.Appender.RollingFileAppender.ActivateOptions()
at log4net.Program.Main(String[] args) in D:\Temp\Egbert\log4net\log4net\Program.cs:line 29
It turns out that when there's already a file present in the target directory, above mentioned error is thrown.
Below a repro - first time you run it, it will work because no file is present. The second time it fails:
static void Main(string[] args)
{
PatternLayout patternLayout = new PatternLayout
{
ConversionPattern = @"%date [%thread] %-5level %logger [%property{NDC}] - %message%newline"
};
patternLayout.ActivateOptions();
RollingFileAppender rollingFileAppender = new RollingFileAppender
{
AppendToFile = true,
File = @"C:\TempLog\",
Layout = patternLayout,
DatePattern = "yyyy-MM-dd'.log'",
MaxSizeRollBackups = 10,
MaximumFileSize = "5MB",
RollingStyle = RollingFileAppender.RollingMode.Composite,
StaticLogFileName = false,
};
rollingFileAppender.ActivateOptions();
}
moeash
Metadata
Metadata
Assignees
Labels
No labels