I'm running a Java/Scala application in a container on GKE, and the logs are not populating in Stackdriver.
The GCP Console is showing that "Stackdriver Kubernetes Engine Monitoring" is enabled on the cluster, and "Legacy Stackdriver Logging" is disabled.
I've tried two types of logback files, one using ConsoleAppender
and one using com.google.cloud.logging.logback.LoggingAppender
, but neither works.
If I run a node.js app in GKE, then the console.log entries do show in Stackdriver.
To add some more detail that may help clarify, my main application container is a Node app that spawns a Java app. The Node app logs show in Stackdriver, but the Java app logs do not. I do set the GOOGLE_APPLICATION_CREDENTIALS
environment variable to a service account I'm using with permission to write to Datastore, Cloud Storage and PubSub. I didn't adding logging permissions to that account, because I figured there is another container or lower level process that writes the logs.
The last logback file I tried is:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<target>System.out</target>
<encoder>
<pattern>%X{akkaTimestamp} %-5level[%thread] %logger{0} - %msg%n</pattern>
</encoder>
</appender>
<appender name="ASYNC" class="ch.qos.logback.classic.AsyncAppender">
<appender-ref ref="STDOUT"/>
</appender>
<logger name="akka" level="INFO" />
<root level="INFO">
<appender-ref ref="STDOUT"/>
</root>
</configuration>
What am I missing?