I have an application that uses the Ent Lib 4.1 logging application block. This application runs on XP SP2+, Windows Vista, and Windows 7.
Most of the time, my logging works fine. (It typically targets the Event Log trace listener.) Sometimes, and I'm not sure what triggers it, a Windows XP machine will simply stop logging. I've tried adding a flat file trace listener to see if the issue was with the Event Log, but the flat file doesn't work either. Rebooting doesn't fix it either.
On all of the machines where it fails, it had been working previously. It also seems isolated to Windows XP SP2/SP3. It doesn't happen on Vista or 7.
Ideas?
Update: I tried removing all trace listeners except for the flat file, and this worked. So the issue is with the event log trace listener, and apparently whatever is happening is causing the Ent Lib to completely fail to log anything - including errors regarding the logging process.
@RMD, you are right. When an exception is raised (e.g. Event Log is full) then the exception causes all other trace listeners for that category to not be processed.
That, on the other hand, is not entirely true. Yes, all of the regular trace listeners will not be processed but there is still the the errors Special Source. I would recommend setting this to its own file (in my experience the EventLog will give more issues with permissions etc.) to capture any logging errors:
If that was setup with proper permissions and the disk was not full (etc.) then you would have seen the error in that log file along with the original information:
So, you will get your original log information which you may be able to extract and manually insert into any log history that you are saving (e.g. reporting, analysis). Plus as a bonus you get the information about why the log entry could not be written so that it can (hopefully!) be remediated.
I figured it out. Apparently, if one trace listener fails for a category, no log entry will be recorded for any trace listener. In other words, if the event log trace listener fails, the flat file trace listener will never be called.
In my case, the event log was full on the XP machine. This was causing the event log trace listener to fail.