You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 19, 2022. It is now read-only.
While deploying a Spring Boot app that uses GCP Stackdriver logging on an on-premise OpenShift environment I encountered a NPE while the logback-spring.xml was being loaded. I was using the config as per your example. It was quite puzzling since it was working when starting the Docker container locally. As you can see the error doesn't tell that much.
Thanks for such a detailed report @maros7!
It just looks like a bug in the Google Cloud Java Logging library. First, not everything that runs in a container runs on GKE. Second, zoneId.contains("/") should be guarded against zoneId being null.
Is that right, or am I missing something?
Would you mind filing the issue on Google Cloud Java Github as well? Otherwise, we can do it. Thanks!
While deploying a Spring Boot app that uses GCP Stackdriver logging on an on-premise OpenShift environment I encountered a NPE while the
logback-spring.xml
was being loaded. I was using the config as per your example. It was quite puzzling since it was working when starting the Docker container locally. As you can see the error doesn't tell that much.So I created a
CustomerAppender
which simply extendedLoggingAppender
overriding theLoggingAppender#start
method.Now I got a more informative exception message:
When the environment variable
KUBERNETES_SERVICE_HOST
is set they will default tocontainer
and notglobal
. See https://github.com/googleapis/google-cloud-java/blob/master/google-cloud-clients/google-cloud-logging/src/main/java/com/google/cloud/logging/MonitoredResourceUtil.java#L177. Thus resulting in a NPE in https://github.com/googleapis/google-cloud-java/blob/master/google-cloud-clients/google-cloud-core/src/main/java/com/google/cloud/MetadataConfig.java#L44-L49 when running on a non GKE Kubernetes. I was able to work around this issue by using thislogback-spring.xml
.But maybe this should be noted in the documentation?
The text was updated successfully, but these errors were encountered: