{"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/0c51461d27177d997e14c642fe18c11668fc09a3/gcp/observability/logging.go#L472-L506","documentation":"startLogging called newLoggingExporter (an alias for newCloudLoggingExporter) and it failed; this is the outer wrapper at logging.go:490 returned to observability.Start. The inner %v is the error from 250. Because Start fails, no client/server logging filters get registered.","triggerScenarios":"observability.Start with a cloud_logging block in the config but ADC missing/invalid, project id bad, network to logging.googleapis.com blocked, or the Cloud Logging API disabled. Same root causes as error 250; this is the Start-level surface.","commonSituations":"Same as 250 in production deployments; surfaces when callers log only the Start error and not the inner exporter error. Often seen on first deploy of the observability plugin.","solutions":["Read the inner %v (same diagnosis as error 250): fix ADC, project id, network, API enablement.","Ensure GOOGLE_APPLICATION_CREDENTIALS or ADC is set before the process starts.","Validate that Cloud Logging API is enabled on config.ProjectID.","If logging is non-essential, drop cloud_logging from the config so Start does not try to build the exporter.","Retry Start after fixing credentials (Start is meant to be called once, so a fresh process is cleanest)."],"exampleFix":"// before\n{\"project_id\":\"\",\"cloud_logging\":{}}\n\n// after\n{\"project_id\":\"my-proj\",\"cloud_logging\":{}}\n# plus\nexport GOOGLE_APPLICATION_CREDENTIALS=/etc/sa.json","handlingStrategy":"try-catch","validationCode":"// Same pre-flight as error 250: ensure gcplogging.NewClient works before Start.\nif _, err := gcplogging.NewClient(ctx, \"projects/\"+projectID); err != nil {\n    return fmt.Errorf(\"Cloud Logging unreachable, will not call Start: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"if err := observability.Start(ctx); err != nil {\n    if strings.Contains(err.Error(), \"unable to create CloudLogging exporter\") {\n        log.Fatalf(\"Cloud Logging exporter creation failed; verify ADC, project_id, network, API: %v\", err)\n    }\n    return err\n}","preventionTips":["Log the full error chain so the inner gcplogging.NewClient error is visible.","If logging is optional, omit cloud_logging from the config.","Run a startup probe that creates and closes a logging client before serving traffic."],"tags":["observability","cloud-logging","startup","gcp"],"backgroundTag":null,"analyzedSha":"0c51461d27177d997e14c642fe18c11668fc09a3","analyzedAt":"2026-08-11T14:49:15.055Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}