Skip to content

Commit f163d30

Browse files
Fix #244 Exception with RollingFileAppender when files are already present (#251)
1 parent 05e5c66 commit f163d30

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/log4net/Appender/RollingFileAppender.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -791,7 +791,8 @@ private void InitializeFromOneFile(string baseFile, string curFileName)
791791
{
792792
curFileName = curFileName.ToLowerInvariant();
793793
baseFile = baseFile.ToLowerInvariant();
794-
var baseFileWithoutExtension = Path.Combine(Path.GetDirectoryName(baseFile) ?? "", Path.GetFileNameWithoutExtension(baseFile));
794+
string dir = string.IsNullOrEmpty(baseFile) ? "" : Path.GetDirectoryName(baseFile);
795+
var baseFileWithoutExtension = Path.Combine(dir ?? "", Path.GetFileNameWithoutExtension(baseFile));
795796

796797
if (curFileName.StartsWith(baseFileWithoutExtension) == false)
797798
{

0 commit comments

Comments
 (0)