eimhof opened a new issue, #244:
URL: https://github.com/apache/logging-log4net/issues/244

   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();
   }
   ```
   
   


-- 
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: notifications-unsubscr...@logging.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to