My personal vote for a capable logging library goes to SmartInspect because in the end it’s not just about writing a log file but also reading it later and depending on the amount you want more than a txt file with walls of text but a capable viewer with filter and search functionality.
@Malcolm You might want to look into some SEO because it requires some significant effort to even discover the product page.
SmartInspect does look good and supports XE, so I’ve downloaded the trial to check it out.
That smells like anti virus to me
Do you think using something better like SmartInspect would solve the access issue? I don’t have any control over what AV is on the systems.
Where are you writing the log file to? That could have an impact on how it’s treated by av software.
The logs are written to:
There’s config stuff stored in other similar folders, but no exceptions accessing those.
That should be ok, although in it’s quite often the case that the roaming profile folder is on a network drive - so I would log to AppData\Local if possible.
It shouldn’t need to be in a class, and yes the actual logging code is after the exit/end.
I use this to get the path:
SHGetFolderPath(0, CSIDL_APPDATA, 0, 0, FilePath);
Hmmm… I’ve installed the SmartInspect trial, but XE complains about a missing DLL for smartInspect XE.
Jumping over to D11, there’s a SmartInspect menu which I’m guessing should also be there in XE.
I’ll find a tutorial on it and go from there.
What is the missing DLL? I have used SmartInspect for many years, and don’t recall any DLLs associated with it. This was one of the reasons I like it so much.
Here’s the error. I’ve contacted Code Partners about it.
We get sporadic “file in use by another process” errors in our apps that are file heavily (downloading, unzipping, parsing, zipping thousands of files) but never for our log file. It is always caused by two things:
- Anti-virus (we ask customers to add an exception/allowed/trust for our data folders to their AV app)
- Windows search indexer (we ask customers to consider disabling the indexing of file contents, primarily on servers)
So if some multi-threading/dup log open issue is ruled out then look at these.
Obviously, things like having a file open in Excel or some other app that denies sharing will cause it too but that’s an easy one to identify and solve.
I should look at SmartInspect. We deal with some pretty large log and other text files and use klogg. A great simple viewer that handles huge files with very fast search, manual marking and auto filtering and highlighting, follow mode, etc. Easy to mark separate lines from different parts of the file to put them into a common view for comparing.