4

I have an ASP.NET MVC website on Azure using log4net file appender. I cannot download the log files with FileZilla because of the following error:

Response: 550 The process cannot access the file because it is being used by another process. Error: Critical file transfer error

Is there a setting on log or Azure that I can use the be able to download log files while the web application is running? I do not want to shut down web app or IIS because of that.

Zanchey
  • 3,051
  • 22
  • 28
elector
  • 41
  • 2

1 Answers1

1

You could try setting the locking method on the Appender to either one of the following:

<lockingModel type="log4net.Appender.FileAppender+MinimalLock" />

or

<lockingModel type="log4net.Appender.FileAppender+InterProcessLock" />

Alternatively you could switch to using the RollingFileAppender and then only download log files that aren't currently being written to. This Appender can rotate files based on date/time or file size and can limit the number of files it creates to avoid running out of local storage space.

Simon W
  • 320
  • 1
  • 8
  • Hi Simon. Thank you for the answer. I am using the RollingFileAppender. But I would like to read (download) the files currently being written to. That's my problem. If you are saying that this is not possible I will need to look into SQL appender or some other option to see the log files "live". – elector Jan 30 '15 at 08:26
  • I blogged about using TraceAppender with Azure Diagnotics last year. This writes to a Storage Table which you could read back as required. http://blog.kloud.com.au/2014/10/22/logging-with-log4net-and-azure-diagnostics-on-web-and-worker-roles/ – Simon W Jan 30 '15 at 10:41