I am setting up a spring boot application where the logs are sent to google cloud stackdriver. I am using the logback appender for Stackdriver Logging and the logback file from their documentation https://cloud.google.com/logging/docs/setup/java.
I added GOOGLE_CLOUD_PROJECT and GOOGLE_APPLICATION_CREDENTIALS in Intellij to the environment variables. Further, I set them as environment variables in windows as well. When I start the application I always get: PERMISSION_DENIED: The request is missing a valid API key
.
I installed the gcloud and there I can use the cred file as a service account with admin permissions to write and read logs. So the file should work as well as the permissions.
I tried to set the key as an environment variable as well but that didn't help either. What am I missing that it doesn't work?
I found the problem. The GOOGLE_APPLICATION_CREDENTIALS file needs to be set via the logback.xml with the credentialsFile
tag.