A number of environment variables can be used to configure the behavior of the library. There are also functions to configure this behavior in code. The environment variables are convenient when troubleshooting problems.
Setting the Default Project
Some of the GCS APIs need aprojectas a parameter. For such APIs the application can (a) call an overload that takes the project id as a parameter, (b) define the project explicitly when theClientobject is constructed, or (c) set theGOOGLE_CLOUD_PROJECTenvironment variable to the desired project id. If you have set this environment variable the code can be even simpler:
GOOGLE_CLOUD_CPP_STORAGE_REST_CONFIG=...: configuration for the REST protocol, but currently unused.
GOOGLE_CLOUD_CPP_STORAGE_GRPC_CONFIG=...: this is deprecated.
Logging
CLOUD_STORAGE_ENABLE_TRACING=raw-client: enables logging for each "RPC" generated by the library. Unless you have configured your own logging backend, you should also setGOOGLE_CLOUD_CPP_ENABLE_CLOGto produce any output on the program's console.
CLOUD_STORAGE_ENABLE_TRACING=http: enables logging for the full http traffic generated by the library.
CLOUD_STORAGE_ENABLE_TRACING=raw-client,http: enables all logging.
See Also
google::cloud::GrpcTracingOptionsOptionGOOGLE_CLOUD_CPP_ENABLE_CLOG=yes: turns on logging in the library, basically the library always "logs" but the logging infrastructure has no backend to actually print anything until the application sets a backend or they set this environment variable.
[[["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-09-04 UTC."],[[["\u003cp\u003eThis document provides a comprehensive list of storage library versions, ranging from the latest release candidate 2.37.0-rc down to version 2.11.0, each with a corresponding link to its storage environment documentation.\u003c/p\u003e\n"],["\u003cp\u003eEnvironment variables like \u003ccode\u003eGOOGLE_CLOUD_PROJECT\u003c/code\u003e can be used to configure library behavior, such as setting the default project for APIs that require one.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eCLOUD_STORAGE_EMULATOR_ENDPOINT\u003c/code\u003e variable allows overriding the default endpoint, which is primarily intended for testing purposes.\u003c/p\u003e\n"],["\u003cp\u003eTracing can be enabled for raw client RPCs and full HTTP traffic using \u003ccode\u003eCLOUD_STORAGE_ENABLE_TRACING\u003c/code\u003e with values like \u003ccode\u003eraw-client\u003c/code\u003e, \u003ccode\u003ehttp\u003c/code\u003e, or \u003ccode\u003eraw-client,http\u003c/code\u003e, and logging output can be toggled with \u003ccode\u003eGOOGLE_CLOUD_CPP_ENABLE_CLOG=yes\u003c/code\u003e.\u003c/p\u003e\n"]]],[],null,["Version 2.32.0keyboard_arrow_down\n\n- [2.42.0-rc (latest)](/cpp/docs/reference/storage/latest/storage-env)\n- [2.41.0](/cpp/docs/reference/storage/2.41.0/storage-env)\n- [2.40.0](/cpp/docs/reference/storage/2.40.0/storage-env)\n- [2.39.0](/cpp/docs/reference/storage/2.39.0/storage-env)\n- [2.38.0](/cpp/docs/reference/storage/2.38.0/storage-env)\n- [2.37.0](/cpp/docs/reference/storage/2.37.0/storage-env)\n- [2.36.0](/cpp/docs/reference/storage/2.36.0/storage-env)\n- [2.35.0](/cpp/docs/reference/storage/2.35.0/storage-env)\n- [2.34.0](/cpp/docs/reference/storage/2.34.0/storage-env)\n- [2.33.0](/cpp/docs/reference/storage/2.33.0/storage-env)\n- [2.32.0](/cpp/docs/reference/storage/2.32.0/storage-env)\n- [2.31.0](/cpp/docs/reference/storage/2.31.0/storage-env)\n- [2.30.0](/cpp/docs/reference/storage/2.30.0/storage-env)\n- [2.29.0](/cpp/docs/reference/storage/2.29.0/storage-env)\n- [2.28.0](/cpp/docs/reference/storage/2.28.0/storage-env)\n- [2.27.0](/cpp/docs/reference/storage/2.27.0/storage-env)\n- [2.26.0](/cpp/docs/reference/storage/2.26.0/storage-env)\n- [2.25.1](/cpp/docs/reference/storage/2.25.1/storage-env)\n- [2.24.0](/cpp/docs/reference/storage/2.24.0/storage-env)\n- [2.23.0](/cpp/docs/reference/storage/2.23.0/storage-env)\n- [2.22.1](/cpp/docs/reference/storage/2.22.1/storage-env)\n- [2.21.0](/cpp/docs/reference/storage/2.21.0/storage-env)\n- [2.20.0](/cpp/docs/reference/storage/2.20.0/storage-env)\n- [2.19.0](/cpp/docs/reference/storage/2.19.0/storage-env)\n- [2.18.0](/cpp/docs/reference/storage/2.18.0/storage-env)\n- [2.17.0](/cpp/docs/reference/storage/2.17.0/storage-env)\n- [2.16.0](/cpp/docs/reference/storage/2.16.0/storage-env)\n- [2.15.1](/cpp/docs/reference/storage/2.15.1/storage-env)\n- [2.14.0](/cpp/docs/reference/storage/2.14.0/storage-env)\n- [2.13.0](/cpp/docs/reference/storage/2.13.0/storage-env)\n- [2.12.0](/cpp/docs/reference/storage/2.12.0/storage-env)\n- [2.11.0](/cpp/docs/reference/storage/2.11.0/storage-env) \n\nEnvironment Variables\n=====================\n\nA number of environment variables can be used to configure the behavior of the library. There are also functions to configure this behavior in code. The environment variables are convenient when troubleshooting problems.\n\nSetting the Default Project\n---------------------------\n\nSome of the GCS APIs need a [project](https://cloud.google.com/storage/docs/projects) as a parameter. For such APIs the application can (a) call an overload that takes the project id as a parameter, (b) define the project explicitly when the `Client` object is constructed, or (c) set the `GOOGLE_CLOUD_PROJECT` environment variable to the desired project id. If you have set this environment variable the code can be even simpler: \n\n namespace gcs = ::google::cloud::storage;\n using ::google::cloud::StatusOr;\n [](gcs::Client client, std::string const& bucket_name) {\n StatusOr\u003cgcs::BucketMetadata\u003e bucket_metadata =\n client.CreateBucket(bucket_name, gcs::BucketMetadata());\n if (!bucket_metadata) throw std::move(bucket_metadata).status();\n\n std::cout \u003c\u003c \"Bucket \" \u003c\u003c bucket_metadata-\u003ename() \u003c\u003c \" created.\"\n \u003c\u003c \"\\nFull Metadata: \" \u003c\u003c *bucket_metadata \u003c\u003c \"\\n\";\n }\n\n###### See Also\n\n[`google::cloud::storage::ProjectIdOption`](/cpp/docs/reference/storage/2.32.0/structgoogle_1_1cloud_1_1storage_1_1ProjectIdOption)\n\nEndpoint Overrides\n------------------\n\n`CLOUD_STORAGE_EMULATOR_ENDPOINT=...`: override the default endpoint used by the library. Intended for testing only.\n\n`CLOUD_STORAGE_TESTBENCH_ENDPOINT=...`: **DEPRECATED** please use `CLOUD_STORAGE_EMULATOR_ENDPOINT` instead.\n\n###### See Also\n\n[`google::cloud::storage::RestEndpointOption`](/cpp/docs/reference/storage/2.32.0/structgoogle_1_1cloud_1_1storage_1_1RestEndpointOption)\n\n###### See Also\n\n[`google::cloud::storage::IamEndpointOption`](/cpp/docs/reference/storage/2.32.0/structgoogle_1_1cloud_1_1storage_1_1IamEndpointOption)\n\nEnabling Experimental Behaviors\n-------------------------------\n\n`GOOGLE_CLOUD_CPP_STORAGE_REST_CONFIG=...`: configuration for the REST protocol, but currently unused.\n\n`GOOGLE_CLOUD_CPP_STORAGE_GRPC_CONFIG=...`: this is deprecated.\n\nLogging\n-------\n\n`CLOUD_STORAGE_ENABLE_TRACING=raw-client`: enables logging for each \"RPC\" generated by the library. Unless you have configured your own logging backend, you should also set `GOOGLE_CLOUD_CPP_ENABLE_CLOG` to produce any output on the program's console.\n\n`CLOUD_STORAGE_ENABLE_TRACING=http`: enables logging for the full http traffic generated by the library.\n\n`CLOUD_STORAGE_ENABLE_TRACING=raw-client,http`: enables all logging.\n\n###### See Also\n\n[`google::cloud::GrpcTracingOptionsOption`](https://cloud.google.com/cpp/docs/reference/common/latest/structgoogle_1_1cloud_1_1GrpcTracingOptionsOption.html)`GOOGLE_CLOUD_CPP_ENABLE_CLOG=yes`: turns on logging in the library, basically the library always \"logs\" but the logging infrastructure has no backend to actually print anything until the application sets a backend or they set this environment variable.\n\n###### See Also\n\n[`google::cloud::LogBackend`](https://cloud.google.com/cpp/docs/reference/common/latest/classgoogle_1_1cloud_1_1LogBackend.html)\n\n###### See Also\n\n[`google::cloud::LogSink`](https://cloud.google.com/cpp/docs/reference/common/latest/classgoogle_1_1cloud_1_1LogSink.html)"]]