Install the Google.Cloud.Logging.V2 package from NuGet. Add it to
your project in the normal way (for example by right-clicking on the
project in Visual Studio and choosing "Manage NuGet Packages...").
If you wish to use the log4net integration, install the
Google.Cloud.Logging.Log4Net package in the same way.
Authentication
When running on Google Cloud, no action needs to be taken to authenticate.
Otherwise, the simplest way of authenticating your API calls is to
set up Application Default Credentials.
The credentials will automatically be used to authenticate. See
Set up Application Default Credentials for more details.
Create a client instance by calling the static Create or CreateAsync methods. Alternatively,
use the builder class associated with each client class (e.g. ConfigServiceV2ClientBuilder for ConfigServiceV2Client)
as an easy way of specifying custom credentials, settings, or a custom endpoint. Clients are thread-safe,
and we recommend using a single instance across your entire application unless you have a particular need
to configure multiple client objects separately.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-28 UTC."],[[["\u003cp\u003e\u003ccode\u003eGoogle.Cloud.Logging.V2\u003c/code\u003e is a .NET client library for the Google Cloud Logging API, with the latest version being 4.4.0.\u003c/p\u003e\n"],["\u003cp\u003eThis library offers integrations with popular logging frameworks like log4net and NLog through separate NuGet packages (\u003ccode\u003eGoogle.Cloud.Logging.Log4Net\u003c/code\u003e and \u003ccode\u003eGoogle.Cloud.Logging.NLog\u003c/code\u003e, respectively).\u003c/p\u003e\n"],["\u003cp\u003eAuthentication on Google Cloud is automatic, while elsewhere, you can set up Application Default Credentials for API authentication.\u003c/p\u003e\n"],["\u003cp\u003eThird-party libraries such as Logary and Serilog also support Google Stackdriver logging, each with its own specific NuGet package and configuration instructions.\u003c/p\u003e\n"],["\u003cp\u003eThe library provides low-level access to the raw RPC API through client classes like \u003ccode\u003eConfigServiceV2Client\u003c/code\u003e, \u003ccode\u003eLoggingServiceV2Client\u003c/code\u003e, and \u003ccode\u003eMetricsServiceV2Client\u003c/code\u003e, which can be instantiated via static \u003ccode\u003eCreate\u003c/code\u003e or \u003ccode\u003eCreateAsync\u003c/code\u003e methods.\u003c/p\u003e\n"]]],[],null,["Version latestkeyboard_arrow_down\n\n- [4.4.0 (latest)](/dotnet/docs/reference/Google.Cloud.Logging.V2/latest)\n- [4.3.0](/dotnet/docs/reference/Google.Cloud.Logging.V2/4.3.0)\n- [4.2.0](/dotnet/docs/reference/Google.Cloud.Logging.V2/4.2.0)\n- [4.1.0](/dotnet/docs/reference/Google.Cloud.Logging.V2/4.1.0)\n- [4.0.0](/dotnet/docs/reference/Google.Cloud.Logging.V2/4.0.0)\n- [3.6.0](/dotnet/docs/reference/Google.Cloud.Logging.V2/3.6.0)\n- [3.5.0](/dotnet/docs/reference/Google.Cloud.Logging.V2/3.5.0)\n- [3.4.0](/dotnet/docs/reference/Google.Cloud.Logging.V2/3.4.0)\n- [3.3.0](/dotnet/docs/reference/Google.Cloud.Logging.V2/3.3.0) \n\nGoogle.Cloud.Logging.V2\n=======================\n\n`Google.Cloud.Logging.V2` is a.NET client library for the [Google Cloud Logging API](https://cloud.google.com/logging/).\n\nNote:\nThis documentation is for version `4.4.0` of the library.\nSome samples may not work with other versions.\n\n- Integration with [log4net](https://logging.apache.org/log4net/) is provided by the [Google.Cloud.Logging.Log4Net](../../Google.Cloud.Logging.Log4Net/latest) package.\n- Integration with [NLog](https://nlog-project.org/) is provided by the [Google.Cloud.Logging.NLog](../../Google.Cloud.Logging.NLog/latest) package.\n\nInstallation\n------------\n\nInstall the `Google.Cloud.Logging.V2` package from NuGet. Add it to\nyour project in the normal way (for example by right-clicking on the\nproject in Visual Studio and choosing \"Manage NuGet Packages...\").\n\nIf you wish to use the log4net integration, install the\n`Google.Cloud.Logging.Log4Net` package in the same way.\n\nAuthentication\n--------------\n\nWhen running on Google Cloud, no action needs to be taken to authenticate.\n\nOtherwise, the simplest way of authenticating your API calls is to\nset up Application Default Credentials.\nThe credentials will automatically be used to authenticate. See\n[Set up Application Default Credentials](https://cloud.google.com/docs/authentication/provide-credentials-adc) for more details.\n\nSupport from third party libraries\n----------------------------------\n\n- [Logary](https://github.com/logary/logary) supports Google Stackdriver logging. Install the [NuGet package](https://www.nuget.org/packages/Logary.Targets.Stackdriver) and see [instructions on the project homepage](https://github.com/logary/logary#stackdriver-target).\n- [Serilog](https://serilog.net/) supports Google Stackdriver Logging. Install the [NuGet package](https://www.nuget.org/packages/Serilog.Sinks.GoogleCloudLogging/) `Serilog.Sinks.GoogleCloudLogging` and [configure options](https://github.com/manigandham/serilog-sinks-googlecloudlogging).\n\nRaw RPC API\n-----------\n\nIf required, this package provides a low-level abstraciton over the\nraw RPC API.\n\nAll operations are performed through the following client classes:\n\n- [ConfigServiceV2Client](/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.ConfigServiceV2Client)\n- [LoggingServiceV2Client](/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.LoggingServiceV2Client)\n- [MetricsServiceV2Client](/dotnet/docs/reference/Google.Cloud.Logging.V2/latest/Google.Cloud.Logging.V2.MetricsServiceV2Client)\n\nCreate a client instance by calling the static `Create` or `CreateAsync` methods. Alternatively,\nuse the builder class associated with each client class (e.g. ConfigServiceV2ClientBuilder for ConfigServiceV2Client)\nas an easy way of specifying custom credentials, settings, or a custom endpoint. Clients are thread-safe,\nand we recommend using a single instance across your entire application unless you have a particular need\nto configure multiple client objects separately."]]