grpc/grpc-go · error

unable to create CloudLogging exporter: %v

Error message

unable to create CloudLogging exporter: %v

What it means

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.

Source

Thrown at gcp/observability/logging.go:490

		eventConfigs = append(eventConfigs, eventConfig)
	}
	serverSideLogger := &binaryLogger{
		EventConfigs: eventConfigs,
		exporter:     exporter,
		projectID:    config.ProjectID,
		clientSide:   false,
	}
	internal.AddGlobalServerOptions.(func(opt ...grpc.ServerOption))(internal.BinaryLogger.(func(bl iblog.Logger) grpc.ServerOption)(serverSideLogger))
}

func startLogging(ctx context.Context, config *config) error {
	if config == nil || config.CloudLogging == nil {
		return nil
	}
	var err error
	lExporter, err = newLoggingExporter(ctx, config)
	if err != nil {
		return fmt.Errorf("unable to create CloudLogging exporter: %v", err)
	}

	registerClientRPCEvents(config, lExporter)
	registerServerRPCEvents(config, lExporter)
	return nil
}

func stopLogging() {
	internal.ClearGlobalDialOptions()
	internal.ClearGlobalServerOptions()
	if lExporter != nil {
		// This Close() call handles the flushing of the logging buffer.
		lExporter.Close()
	}
}

View on GitHub (pinned to 03255a9237)

Solutions

  1. Resolve the underlying error 218 cause (ADC, project id, network).
  2. If observability is optional in your environment, downgrade cloud_logging to disabled or wrap Start in a non-fatal handler.
  3. Confirm config.ProjectID is populated and credentials have Roles/Logging Writer before calling Start.

Example fix

// before
observability.Start(ctx) // panics / returns "unable to create CloudLogging exporter"

// after
// fix ADC + project, then:
if err := observability.Start(ctx); err != nil { log.Fatalf("observability: %v", err) }
Defensive patterns

Strategy: try-catch

Try / catch

if err := observability.Start(ctx); err != nil {
    if strings.Contains(err.Error(), "CloudLogging exporter") {
        // ADC/project/network issue; degrade gracefully or fail
    }
    return err
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of grpc/grpc-go@03255a9237 (2026-08-07). Data as JSON: /api/errors/ddc907b094e855c9. Report an issue: GitHub.