Not letting the process run at any time around midnight seems to have solved 
the issue for now.

The setup I have is that the process runs on a Hyper-V virtualised server, 
writing to a log file stored on a network share on a completely different 
server.
Do you think anything related to this could cause the issue?

From: Dominik Psenner [mailto:[email protected]]
Sent: Thursday, 29 May 2014 10:01 PM
To: 'Log4NET User'
Subject: AW: RollingFileAppender overwriting file

Multithreading shouldn't be an issue. Try this:

http://stackoverflow.com/questions/2075603/log4net-process-id-information

Von: Tim Sirmovics [mailto:[email protected]]
Gesendet: Donnerstag, 29. Mai 2014 00:45
An: Log4NET User
Betreff: RE: RollingFileAppender overwriting file

I have changed the locking model to InterProcessLock but the problem still 
occurs.
I started logging the thread number and found it is consistently "1" throughout 
all runs of the application.

At this stage with no other ideas I am going to make sure the application does 
not execute from 11:30 - 12:30 and see if this helps it to roll the log over 
correctly.

From: Dominik Psenner [mailto:[email protected]]
Sent: Tuesday, 27 May 2014 04:24 PM
To: 'Log4NET User'
Subject: AW: RollingFileAppender overwriting file

Just to be sure, use an InterProcessLock in your configuration and check if 
this happens again. You might also want to include process information in the 
log messages.

Von: Tim Sirmovics [mailto:[email protected]]
Gesendet: Dienstag, 27. Mai 2014 02:49
An: [email protected]<mailto:[email protected]>
Betreff: FW: RollingFileAppender overwriting file

I have been using the RollingFileAppender through numerous log4net version for 
about 3-4 years.
In the last few days I am now experiencing the following issue:


1.       Assume today is 27/05/2014

2.       Current log file is called Debug.log

3.       Log file builds up throughout the day.

4.       Next day (28/05/2014), log file Debug.log.27.log exists, last write 
time according to windows is 27/05/2014 11:59 pm

5.       Open log file, all entries from 27/05 are gone, log only contains a 
very small number of entries dated 28/05/2014 just after midnight.

I am now losing my logs for each day as they are being overwritten by the first 
few logs after midnight.
Only one process writes to this file.
The process is limited to only running a single instance at a time.
I have not changed my configuration for a long time, however I have included it 
below.


<!-- Last month, one file per day -->
  <appender name="DebugRollingFileAppender" 
type="log4net.Appender.RollingFileAppender">
    <file value="Logs\Debug.log" />
    <appendToFile value="true" />
    <lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
    <rollingStyle value="Date" />
    <datePattern value=".dd'.log'" />
    <maxSizeRollBackups value="14" />
    <threshold value="DEBUG"/>
    <layout type="log4net.Layout.PatternLayout">
      <conversionPattern value="|%date| |%-5level| 
|%property{log4net:HostName}| |%logger{2}|: %message%newline" />
    </layout>
  </appender>


Is there any way I can prevent this from happening?

Tim Sirmovics
IT
[email protected]<mailto:[email protected]>

[www.axima.com.au]
AXIMA Pty. Ltd.
135 Boundary Road, Laverton North
Victoria 3026 Australia
T: +61 3 83685300
F: +61 3 83685333
W: www.axima.com.au<http://www.axima.com.au>

This message and any files transmitted with it are confidential and are 
intended solely for the use of those persons to whom the message is addressed. 
If you have received this message in error, please destroy and delete this 
message from your computer. Any unauthorised reproduction of this message or 
any files transmitted with it is strictly prohibited. All business is conducted 
pursuant to Axima's trading terms and conditions which may exclude or limit 
liability in certain circumstances.


-------------------------------Safe Stamp-----------------------------------
Your Anti-virus Service scanned this email. It is safe from known viruses.
For more information regarding this service, please contact your service 
provider.

-------------------------------Safe Stamp-----------------------------------
Your Anti-virus Service scanned this email. It is safe from known viruses.
For more information regarding this service, please contact your service 
provider.

Reply via email to