Reference documentation and code samples for the Google.Cloud.Diagnostics.Common class LoggingOptions.
Options for a GoogleLogger".
These are options to configure when and what is logged,
as where LoggingServiceOptions configure the logging service,
including the target GCP project, etc.
Keys and values added to Labels should not be null.
If they are, an exception will be thrown when attempting to log an entry.
The entry won't be logged and the exception will be propagated depending
on the value of ExceptionHandling.
Optional, custom labels to be added to log entries.
Keys and values added to labels should not be null.
If they are, an exception will be thrown when attempting to log an entry.
The entry won't be logged and the exception will be propagated depending
on the value of ExceptionHandling.
Optional, the monitored resource. The monitored resource will
be automatically detected if it is not set and will default to the global resource if the detection fails.
See: https://cloud.google.com/logging/docs/api/v2/resource-list
[[["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\u003e\u003ccode\u003eLoggingOptions\u003c/code\u003e is a class for configuring how and what is logged by a \u003ccode\u003eGoogleLogger\u003c/code\u003e, as opposed to \u003ccode\u003eLoggingServiceOptions\u003c/code\u003e which configures the logging service itself.\u003c/p\u003e\n"],["\u003cp\u003eThe class provides properties such as \u003ccode\u003eBufferOptions\u003c/code\u003e, \u003ccode\u003eLabels\u003c/code\u003e, \u003ccode\u003eLogLevel\u003c/code\u003e, \u003ccode\u003eLogName\u003c/code\u003e, \u003ccode\u003eMonitoredResource\u003c/code\u003e, and \u003ccode\u003eRetryOptions\u003c/code\u003e to fine-tune logging behavior.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eLoggingOptions\u003c/code\u003e allows setting custom labels for log entries, ensuring that null values for keys and values in labels are avoided to prevent exceptions during logging.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eCreate\u003c/code\u003e method offers a way to instantiate \u003ccode\u003eLoggingOptions\u003c/code\u003e, with optional parameters to define the minimum log level, log name, custom labels, monitored resource, buffer options, and retry options.\u003c/p\u003e\n"],["\u003cp\u003eThe latest version of \u003ccode\u003eLoggingOptions\u003c/code\u003e available is 5.2.0, with previous versions including 5.1.0, 5.0.0, 4.4.0, and 4.3.1.\u003c/p\u003e\n"]]],[],null,["# Google.Cloud.Diagnostics.Common - Class LoggingOptions (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.LoggingOptions)\n- [5.2.0](/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/5.2.0/Google.Cloud.Diagnostics.Common.LoggingOptions)\n- [5.1.0](/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/5.1.0/Google.Cloud.Diagnostics.Common.LoggingOptions)\n- [5.0.0](/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/5.0.0/Google.Cloud.Diagnostics.Common.LoggingOptions)\n- [4.4.0](/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/4.4.0/Google.Cloud.Diagnostics.Common.LoggingOptions)\n- [4.3.1](/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/4.3.1/Google.Cloud.Diagnostics.Common.LoggingOptions) \n\n public sealed class LoggingOptions\n\nReference documentation and code samples for the Google.Cloud.Diagnostics.Common class LoggingOptions.\n\nOptions for a [GoogleLogger](/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.GoogleLogger)\".\nThese are options to configure when and what is logged,\nas where [LoggingServiceOptions](/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.LoggingServiceOptions) configure the logging service,\nincluding the target GCP project, etc. \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e LoggingOptions \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.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\nProperties\n----------\n\n### BufferOptions\n\n public BufferOptions BufferOptions { get; }\n\nThe buffer options for the logger.\n\n### Labels\n\n public Dictionary\u003cstring, string\u003e Labels { get; }\n\nCustom labels for log entries.\n\n**Remarks** \nKeys and values added to [Labels](/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.LoggingOptions#Google_Cloud_Diagnostics_Common_LoggingOptions_Labels) should not be null.\nIf they are, an exception will be thrown when attempting to log an entry.\nThe entry won't be logged and the exception will be propagated depending\non the value of [ExceptionHandling](/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.RetryOptions#Google_Cloud_Diagnostics_Common_RetryOptions_ExceptionHandling).\n\n### LogLevel\n\n public LogLevel LogLevel { get; }\n\nThe minimum log level.\n\n### LogName\n\n public string LogName { get; }\n\nThe name for the logs.\n\n### MonitoredResource\n\n public MonitoredResource MonitoredResource { get; }\n\nThe monitored resource. See: \u003chttps://cloud.google.com/logging/docs/api/v2/resource-list\u003e\n\n### RetryOptions\n\n public RetryOptions RetryOptions { get; }\n\nThe retry options for the logger.\n\nMethods\n-------\n\n### Create(LogLevel, string, Dictionary\\\u003cstring, string\\\u003e, MonitoredResource, BufferOptions, RetryOptions)\n\n public static LoggingOptions Create(LogLevel logLevel = LogLevel.Information, string logName = null, Dictionary\u003cstring, string\u003e labels = null, MonitoredResource monitoredResource = null, BufferOptions bufferOptions = null, RetryOptions retryOptions = null)\n\nCreate a new instance of [LoggingOptions](/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.LoggingOptions)."]]