The error reporting options. May be null, in which case defaults will be used, in
particular, if running on Google Cloud, the Google Cloud project ID to log to will be detected from
the platform.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["\u003cp\u003eThe \u003ccode\u003eContextExceptionLogger\u003c/code\u003e class provides methods for creating \u003ccode\u003eIContextExceptionLogger\u003c/code\u003e instances, which are used for logging exceptions.\u003c/p\u003e\n"],["\u003cp\u003eThe latest version of \u003ccode\u003eContextExceptionLogger\u003c/code\u003e is 5.2.0, with previous versions available, including 5.1.0, 5.0.0, 4.4.0, and 4.3.1.\u003c/p\u003e\n"],["\u003cp\u003eThree \u003ccode\u003eCreate\u003c/code\u003e methods are available, allowing customization via \u003ccode\u003eErrorReportingServiceOptions\u003c/code\u003e, \u003ccode\u003eErrorReportingOptions\u003c/code\u003e, and \u003ccode\u003eIServiceProvider\u003c/code\u003e, as well as parameters like \u003ccode\u003eprojectId\u003c/code\u003e, \u003ccode\u003eserviceName\u003c/code\u003e, and \u003ccode\u003eversion\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eWhen creating an \u003ccode\u003eIContextExceptionLogger\u003c/code\u003e, you can optionally specify a service provider to add more context to log entries, or the Google Cloud Platform project ID will be automatically detected if unspecified and running on GAE or GCE.\u003c/p\u003e\n"],["\u003cp\u003eThe service name and the version are optional parameters when using the \u003ccode\u003eCreate\u003c/code\u003e methods, as they can be null.\u003c/p\u003e\n"]]],[],null,["# Google.Cloud.Diagnostics.Common - Class ContextExceptionLogger (5.3.0)\n\nVersion latestkeyboard_arrow_down\n\n- [5.3.0 (latest)](/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.ContextExceptionLogger)\n- [5.2.0](/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/5.2.0/Google.Cloud.Diagnostics.Common.ContextExceptionLogger)\n- [5.1.0](/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/5.1.0/Google.Cloud.Diagnostics.Common.ContextExceptionLogger)\n- [5.0.0](/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/5.0.0/Google.Cloud.Diagnostics.Common.ContextExceptionLogger)\n- [4.4.0](/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/4.4.0/Google.Cloud.Diagnostics.Common.ContextExceptionLogger)\n- [4.3.1](/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/4.3.1/Google.Cloud.Diagnostics.Common.ContextExceptionLogger) \n\n public static class ContextExceptionLogger\n\nReference documentation and code samples for the Google.Cloud.Diagnostics.Common class ContextExceptionLogger.\n\nFunctions to create [IContextExceptionLogger](/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.IContextExceptionLogger)s. \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e ContextExceptionLogger \n\nInherited Members\n-----------------\n\n[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) \n[object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) \n[object.MemberwiseClone()](https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone) \n[object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)\n\nNamespace\n---------\n\n[Google.Cloud.Diagnostics.Common](/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common)\n\nAssembly\n--------\n\nGoogle.Cloud.Diagnostics.Common.dll\n\nMethods\n-------\n\n### Create(ErrorReportingServiceOptions, IServiceProvider)\n\n public static IContextExceptionLogger Create(ErrorReportingServiceOptions options, IServiceProvider serviceProvider)\n\nCreates an [IContextExceptionLogger](/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.IContextExceptionLogger).\n\n### Create(string, string, string, ErrorReportingOptions)\n\n public static IContextExceptionLogger Create(string projectId, string serviceName, string version, ErrorReportingOptions options)\n\nCreates an [IContextExceptionLogger](/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.IContextExceptionLogger).\n\n**Remarks** \nThis method will call [Create(string, string, string, ErrorReportingOptions, IServiceProvider)](/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.ContextExceptionLogger#Google_Cloud_Diagnostics_Common_ContextExceptionLogger_Create_System_String_System_String_System_String_Google_Cloud_Diagnostics_Common_ErrorReportingOptions_System_IServiceProvider_)\npassing a null value for the [IServiceProvider](https://learn.microsoft.com/dotnet/api/system.iserviceprovider) parameter, which means that some context information\ncannot be added to log entries because there are no services to obtain that information from.\n\n### Create(string, string, string, ErrorReportingOptions, IServiceProvider)\n\n public static IContextExceptionLogger Create(string projectId, string serviceName, string version, ErrorReportingOptions options, IServiceProvider serviceProvider)\n\nCreates an [IContextExceptionLogger](/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.IContextExceptionLogger)."]]