On Thu, 14 Apr 2005, Dirk Helbig <[EMAIL PROTECTED]>
wrote:

> The source does exists, but log4net may be search it in the wrong
> directory (C:\WINDOWS\System32) ?  In the version I've used before
> it does works.

I'm really not familiar with the code, so my quick look over it may be
completely wrong.  RollOverTime is the only place[1] in the class that
uses the (inherited) File instead of m_baseFileName to calculate file
names - and the later is File converted to an absolute paths.

If you change to code in RollOverTime to use m_baseFileName instead of
File (a few times, see patch at the bottom, that tries to make usage
consistent), does it work?

> I don't want modify the source only for me.

Of course not.  You modify it for yourself and if it works, you share
it with the rest of us ;-)

Cheers

        Stefan

Footnotes: 
[1]  Not strictly true, ActivateOptions does so as well.

Index: src/Appender/RollingFileAppender.cs
===================================================================
RCS file: /home/cvspublic/logging-log4net/src/Appender/RollingFileAppender.cs,v
retrieving revision 1.19
diff -u -r1.19 RollingFileAppender.cs
--- src/Appender/RollingFileAppender.cs 7 Feb 2005 22:33:34 -0000       1.19
+++ src/Appender/RollingFileAppender.cs 15 Apr 2005 20:41:54 -0000
@@ -949,9 +949,9 @@
                                }
                        }
        
-                       if (m_rollDate && File != null && m_scheduledFilename 
== null)
+                       if (m_rollDate && m_baseFileName != null && 
m_scheduledFilename == null)
                        {
-                               m_scheduledFilename = File + 
m_now.ToString(m_datePattern, 
System.Globalization.DateTimeFormatInfo.InvariantInfo);
+                               m_scheduledFilename = m_baseFileName + 
m_now.ToString(m_datePattern, 
System.Globalization.DateTimeFormatInfo.InvariantInfo);
                        }
 
                        if (SecurityContext == null)
@@ -999,9 +999,9 @@
                                //something has gone wrong if we hit this -- we 
should only
                                //roll over if the new file will be different 
from the old
                                string dateFormat = 
m_now.ToString(m_datePattern, 
System.Globalization.DateTimeFormatInfo.InvariantInfo);
-                               if (m_scheduledFilename.Equals(File + 
dateFormat)) 
+                               if (m_scheduledFilename.Equals(m_baseFileName + 
dateFormat)) 
                                {
-                                       ErrorHandler.Error("Compare " + 
m_scheduledFilename + " : " + File + dateFormat);
+                                       ErrorHandler.Error("Compare " + 
m_scheduledFilename + " : " + m_baseFileName + dateFormat);
                                        return;
                                }
          
@@ -1014,19 +1014,19 @@
                                //we may have to roll over a large number of 
backups here
                                for (int i = 1; i <= m_curSizeRollBackups; i++) 
                                {
-                                       string from = File + '.' + i;
+                                       string from = m_baseFileName + '.' + i;
                                        string to = m_scheduledFilename + '.' + 
i;
                                        RollFile(from, to);
                                }
          
-                               RollFile(File, m_scheduledFilename);
+                               RollFile(m_baseFileName, m_scheduledFilename);
                        }
        
                        //We've cleared out the old date and are ready for the 
new
                        m_curSizeRollBackups = 0; 
        
                        //new scheduled name
-                       m_scheduledFilename = File + 
m_now.ToString(m_datePattern, 
System.Globalization.DateTimeFormatInfo.InvariantInfo);
+                       m_scheduledFilename = m_baseFileName + 
m_now.ToString(m_datePattern, 
System.Globalization.DateTimeFormatInfo.InvariantInfo);
 
                        if (fileIsOpen)
                        {
@@ -1188,7 +1188,7 @@
                        LogLog.Debug("RollingFileAppender: curSizeRollBackups 
["+m_curSizeRollBackups+"]");
                        LogLog.Debug("RollingFileAppender: countDirection 
["+m_countDirection+"]");
 
-                       RollOverRenameFiles(File);
+                       RollOverRenameFiles(m_baseFileName);
        
                        // This will also close the file. This is OK since 
multiple close operations are safe.
                        SafeOpenFile(m_baseFileName, false);

Reply via email to