Search code examples
.netloggingenterprise-library

Log files with strange names (Enterprise Library)


I'm using Enterprise Library 3.1 for logging exceptions for some web application. All exceptions should be written to a single XML file (say Errors.xml) on the same server the application run. The problem that sometime in addition to Errors.xml I see files with names like this: 7b53e14b-4b92-43b5-94a0-09666f1c8c4c**ServerName**.xml where ServerName is name of the server. These file are usually small (50kb), but are some with 500kb size. The code that writes an exception to a log is next:

...
SyncLock threadlock // static variable
    ExceptionPolicy.HandleException(ex, "Global Policy")
End SyncLock
...

I can't understand why all these strange files are created. Can somebody help with this?


Solution

  • http://www.codeplex.com/entlib/Thread/View.aspx?ThreadId=29005, see second comment by user fsimonazzi:

    "Regarding the GUID prefix, that's expected when two different trace listener instances open the same file. If the container and the facades are using the same configuration, the container managed instance and the factory created one will try to write to the same file and one of them will add the GUID prefix when it finds the file cannot be opened."

    The reason you have multiple trace listener instances is because you have multiple users accessing your webapp.