This project is read-only.

UlsTraceProviderException HResult: '5' could not write to Trace Log


I am upgrading a MOSS 2007 timer job solution to work for SharePoint 2010 using Visual Studio 2010. I have been using SPG library and it was working perfectly for Logging & Exception handling, however since I updated to new library I have seen strange behaviour and my code to write to ULS log is throwing exception:-

Log Name: Application
Date: 10/29/2012 1:50:53 PM
Event ID: 0
Task Category: None
Level: Error
Keywords: Classic
User: N/A
Category: Logging
An error occurred while writing tot the Trace Log.
ExceptionType: 'UlsTraceProviderException'
ExceptionMessage: 'Could not write trace message: AuditEngine::AuditOwnerCount - Site http://np2appl643v contains 1 administrators'
StackTrace: '   at Microsoft.Practices.SPG.Common.Logging.ULSTraceProvider.CheckHResult(UInt32 result, String errorMessage)
       at Microsoft.Practices.SPG.Common.Logging.ULSTraceProvider.WriteTrace(UInt32 tag, TraceSeverity level, Guid correlationGuid, String exeName, String productName, String categoryName, String message)
       at Microsoft.Practices.SPG.Common.Logging.TraceLogger.WriteLogMessage(TraceSeverity severity, String category, String message, Int32 eventId)
       at Microsoft.Practices.SPG.Common.Logging.TraceLogger.<>c__DisplayClass1.b__0()
       at Microsoft.SharePoint.SPSecurity.<>c__DisplayClass4.b__2()
       at Microsoft.SharePoint.Utilities.SecurityContext.RunAsProcess(CodeToRunElevated secureCode)
       at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(WaitCallback secureCode, Object param)
       at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(CodeToRunElevated secureCode)
       at Microsoft.Practices.SPG.Common.Logging.TraceLogger.Trace(String message, Int32 eventId, TraceSeverity severity, String category)
       at Microsoft.Practices.SPG.Common.Logging.SharePointLogger.WriteToDeveloperTrace(String message, Int32 eventId, TraceSeverity severity, String category)'
Source: 'Microsoft.Practices.SPG.Common'
TargetSite: 'Void CheckHResult(UInt32, System.String)'
Additional Data:
    'HResult' : '5'