Skip to content

README should be updated with required permissions #570

Closed
@averikitsch

Description

@averikitsch

Environment details

  1. Specify the API at the beginning of the title. For example, "BigQuery: ...").
    General, Core, and Other are also allowed as types
  2. OS type and version:
  3. Java version: 11
  4. logging version(s): 2.3.1

Steps to reproduce

  1. Deploy to Cloud Run
  2. 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.

Metadata

Metadata

Assignees

Labels

api: loggingIssues related to the googleapis/java-logging API.lang: javaIssues specific to Java.type: docsImprovement to the documentation for an API.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions