Closed
Description
Environment details
- Specify the API at the beginning of the title. For example, "BigQuery: ...").
General, Core, and Other are also allowed as types - OS type and version:
- Java version: 11
- logging version(s): 2.3.1
Steps to reproduce
- Deploy to Cloud Run
- See error:
java.lang.RuntimeException: java.util.concurrent.ExecutionException: com.google.cloud.logging.LoggingException: io.grpc.StatusRuntimeException: PERMISSION_DENIED: The caller does not have permission
Code example
Call MonitoredResourceUtil.getResource() directly or through using LoggingHandler.addHandler(LOGGER, new LoggingHandler()); for example with java.util.logging.Logger.
private final static Logger LOGGER = Logger.getLogger("HelloWorldApplication");
LoggingHandler.addHandler(LOGGER, new LoggingHandler());
LOGGER.log(new LogRecord(Level.FINEST, "my message!"));
Stack trace
java.lang.RuntimeException: java.util.concurrent.ExecutionException: com.google.cloud.logging.LoggingException: io.grpc.StatusRuntimeException: PERMISSION_DENIED: The caller does not have permission
at com.google.cloud.logging.LoggingImpl.flush(LoggingImpl.java:717)
at com.google.cloud.logging.LoggingImpl.write(LoggingImpl.java:699)
at com.google.cloud.logging.LoggingHandler.publish(LoggingHandler.java:237)
at java.logging/java.util.logging.Logger.log(Unknown Source)
at com.example.helloworld.HelloworldApplication$HelloworldController.hello(HelloworldApplication.java:59)
The docs need to be updated to mention that the service account of the Google Cloud service (for example Cloud Run) needs to be updated to have role Logs Writer
,roles/logging.logWriter
.