{"record":{"id":"ddc907b094e855c9","repo":"grpc/grpc-go","slug":"unable-to-create-cloudlogging-exporter-v","errorCode":null,"errorMessage":"unable to create CloudLogging exporter: %v","messagePattern":"unable to create CloudLogging exporter: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"gcp/observability/logging.go","lineNumber":490,"sourceCode":"\t\teventConfigs = append(eventConfigs, eventConfig)\n\t}\n\tserverSideLogger := &binaryLogger{\n\t\tEventConfigs: eventConfigs,\n\t\texporter:     exporter,\n\t\tprojectID:    config.ProjectID,\n\t\tclientSide:   false,\n\t}\n\tinternal.AddGlobalServerOptions.(func(opt ...grpc.ServerOption))(internal.BinaryLogger.(func(bl iblog.Logger) grpc.ServerOption)(serverSideLogger))\n}\n\nfunc startLogging(ctx context.Context, config *config) error {\n\tif config == nil || config.CloudLogging == nil {\n\t\treturn nil\n\t}\n\tvar err error\n\tlExporter, err = newLoggingExporter(ctx, config)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to create CloudLogging exporter: %v\", err)\n\t}\n\n\tregisterClientRPCEvents(config, lExporter)\n\tregisterServerRPCEvents(config, lExporter)\n\treturn nil\n}\n\nfunc stopLogging() {\n\tinternal.ClearGlobalDialOptions()\n\tinternal.ClearGlobalServerOptions()\n\tif lExporter != nil {\n\t\t// This Close() call handles the flushing of the logging buffer.\n\t\tlExporter.Close()\n\t}\n}\n","sourceCodeStart":472,"sourceCodeEnd":506,"githubUrl":"https://github.com/grpc/grpc-go/blob/03255a9237b6eb32710f6bc4f2de9a675b99fe36/gcp/observability/logging.go#L472-L506","documentation":"startLogging calls newLoggingExporter (an alias for newCloudLoggingExporter) and, on failure, returns \"unable to create CloudLogging exporter: %v\". This is the higher-level wrapper around error 218 surfaced during observability.Start/StartWithOptions. Same underlying failure (Cloud Logging client creation failed) but reported at the public API boundary.","triggerScenarios":"Calling observability.Start(ctx) (or StartWithOptions) with a config that enables cloud_logging, while the Cloud Logging client cannot be constructed (auth, project, network). See error 218 for the proximate causes.","commonSituations":"Same as 218: ADC missing/wrong scope, bad project id, no network route to logging.googleapis.com. Often the first error users see because Start is the entry point.","solutions":["Resolve the underlying error 218 cause (ADC, project id, network).","If observability is optional in your environment, downgrade cloud_logging to disabled or wrap Start in a non-fatal handler.","Confirm config.ProjectID is populated and credentials have Roles/Logging Writer before calling Start."],"exampleFix":"// before\nobservability.Start(ctx) // panics / returns \"unable to create CloudLogging exporter\"\n\n// after\n// fix ADC + project, then:\nif err := observability.Start(ctx); err != nil { log.Fatalf(\"observability: %v\", err) }","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := observability.Start(ctx); err != nil {\n    if strings.Contains(err.Error(), \"CloudLogging exporter\") {\n        // ADC/project/network issue; degrade gracefully or fail\n    }\n    return err\n}","preventionTips":["Resolve error 218 root causes (ADC, project id, network) before calling Start.","If observability is optional, wrap Start so its failure is non-fatal for your app.","Confirm Roles/Logging Writer and project_id are set up in your deployment manifests."],"tags":["grpc","observability","cloud-logging","auth","gcp","startup"],"analyzedSha":"03255a9237b6eb32710f6bc4f2de9a675b99fe36","analyzedAt":"2026-08-07T00:29:34.215Z","schemaVersion":2},"datasetVersion":"2026-08-07T03:17:09.362Z"}