Last post May 24, 2015 09:30 PM by Li Wang
May 21, 2015 01:06 PM|jimmydagher|LINK
I Implemented my own version of a TextWriter to trance events in my site. I'm using MVC 4 WebApi.
I have run code many times in my home PC and other servers and runs great, but in the office I have the problem that it leaves tons of temp files and doesn't clean them up. I believe that it might be the issue with anti-virus or something else locking the
files before IIS delete them.
so what I end up in my folder is:
The code is properly appending to the right file 2015.05.21.adSearch-web-api.log but other files are left behind.
here is the code:
Using tracer = New TextWriterTraceListener(logfile)
For Each logger In events
Dim logType = TraceEventType.Information
If logger.action = cc.logAction.error Then logType = TraceEventType.Error
tracer.TraceEvent(New TraceEventCache, appSession.application, logType, threadId, logger.dateCreated.ToString("yyyy.MM.dd-HH.mm.ss.fff.tt.") + "#" + logger.level.ToString + "#." + logger.source + "." + logger.action + IIf(logger.additional IsNot Nothing, ": " + logger.additional, ""))
again, this only happens in the office, in my desktop and on the servers. Has anyone experienced this before? anti-virus? permissions? iis setting?
Help will be appreciate!
May 22, 2015 04:52 AM|Li Wang|LINK
Thank you for your post.
These files may be cached files or back up files, you could delete these files in safe mode
For more information, you could create a new thread on windows server forums, you could get more help from there.
Link below is for your reference.
Hoping my reply could be helpful to you.
May 22, 2015 06:28 PM|jimmydagher|LINK
Thanks Li for your reply!
My concern was more as to why it is happening than if I could delete them. Problem is that the directory that the files are being created is the log directory and is cluttering the folder and can't find our log files with ease.
Also to delete them i would have to setup some sort of process to keep flushing them out. Do you know why they are not being auto-deleted? and this is only in my company, not on my personal PC or cloud server, so definitely something this the environment.
May 24, 2015 09:30 PM|Li Wang|LINK
This may be a problem of folder permissions.
Please check security property of the log folder. set full control to current user.