# Google.Cloud.Diagnostics.Common - Class LoggingServiceOptions (5.3.0)

<button class="button button-with-icon cloud-select-dropdown__button " aria-haspopup="true">Version latest</button>

- [5.3.0 (latest)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.LoggingServiceOptions)
- [5.2.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/5.2.0/Google.Cloud.Diagnostics.Common.LoggingServiceOptions)
- [5.1.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/5.1.0/Google.Cloud.Diagnostics.Common.LoggingServiceOptions)
- [5.0.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/5.0.0/Google.Cloud.Diagnostics.Common.LoggingServiceOptions)
- [4.4.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/4.4.0/Google.Cloud.Diagnostics.Common.LoggingServiceOptions)
- [4.3.1](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/4.3.1/Google.Cloud.Diagnostics.Common.LoggingServiceOptions)

    public sealed class LoggingServiceOptions

Reference documentation and code samples for the Google.Cloud.Diagnostics.Common class LoggingServiceOptions.

Configuration for initializing Google Cloud Logging.

## Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) \> LoggingServiceOptions

## Inherited Members

[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) [object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) [object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

## Namespace

[Google.Cloud.Diagnostics.Common](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common)

## Assembly

Google.Cloud.Diagnostics.Common.dll

## Properties

### Client

    public LoggingServiceV2Client Client { get; set; }

A client to log entries with. May be null.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.LoggingServiceV2Client.html` |   |

### LogTarget

    public LogTarget LogTarget { get; set; }

Where to log to. May represent a Google Project or Organization.
May be set by setting [ProjectId](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.LoggingServiceOptions#Google_Cloud_Diagnostics_Common_LoggingServiceOptions_ProjectId).
May be null if running on Google Cloud in which case the
Google Cloud Platform project ID will be detected from the platform
and used to build the log target.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.LogTarget` |   |

### LoggerDiagnosticsOutput

    public TextWriter LoggerDiagnosticsOutput { get; set; }

A [TextWriter](https://learn.microsoft.com/dotnet/api/system.io.textwriter) to write diagnostics info about loggers created
with these [LoggingOptions](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.LoggingOptions).
Currently the only diagnostics info we provide is the URL where the logs written
with these options can be found.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.io.textwriter` |   |

### Options

    public LoggingOptions Options { get; set; }

Options for logging. May be null.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.LoggingOptions` |   |

### ProjectId

    public string ProjectId { get; set; }

The Google Cloud Project ID to store the logs in.
May be null if running on Google Cloud, in which case, and if [LogTarget](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.LoggingServiceOptions#Google_Cloud_Diagnostics_Common_LoggingServiceOptions_LogTarget) is
also null the project ID will be detected from the platform
and used to build the log target.
This is an alternate way to set [LogTarget](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.LoggingServiceOptions#Google_Cloud_Diagnostics_Common_LoggingServiceOptions_LogTarget) for [Project](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.LogTargetKind#Google_Cloud_Diagnostics_Common_LogTargetKind_Project).

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.string` |   |

### ServiceName

    public string ServiceName { get; set; }

An identifier of the service, such as the name of the executable or job. May be null.
When set, it will be included in the

    serviceContext

field of the log entry JSON payload.

<br />

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.string` |   |

### Version

    public string Version { get; set; }

A string that represents the version of the service or the source code that logs are written for.
When set, it will be included in the

    serviceContext

field of the log entry JSON payload.

<br />

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.string` |   |