Reputation: 678
I'm deploying a SpringBoot application to Google Appengine inside of a Docker container, the application works as expected, but the logging is pretty horrible. For some reason, it's taking every log that should be output and printing them out as individual lines. Also, the logs seem to be losing some metadata as log levels are printed out but not understood by the Google App Engine log viewer. Any idea what can be done to help the console understand the logs?
Here are some images of what I'm seeing. You can see that the logs are printing each line out individually and even logs that were explicitly info, warning, or error don't show up as those level in the google appengine log viewer.
Here's an excerpt from my gradle build file for the project:
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'spring-boot'
apply plugin: 'sonar-runner'
apply plugin: 'appengine'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'war'
jar {
baseName = 'consumer'
version = '0.0.1-SNAPSHOT'
}
sourceCompatibility = 1.7
targetCompatibility = 1.7
repositories {
mavenCentral()
}
dependencies {
compile("org.springframework.boot:spring-boot-starter-amqp")
compile("org.springframework.boot:spring-boot-starter-web")
exclude module: "spring-boot-starter-tomcat"
compile("org.springframework.boot:spring-boot-starter-jetty")
compile("org.codehaus.jackson:jackson-mapper-asl:1.9.10")
testCompile("org.springfraework.boot:spring-boot-starter-test")
}
eclipse {
classpath {
containers.remove('org.eclipse.jdt.launching.JRE_CONTAINER')
containers 'org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7'
}
}
task wrapper(type: Wrapper) {
gradleVersion = '2.3'
}
Upvotes: 1
Views: 828
Reputation: 3591
The docs on Managed VMs / Custom Runtimes state that you should write your logs to a location on the VM's file-system: /var/log/app_engine/custom_logs
. You can then read about the logs viewer to determine if you can get it to recognize the log level based on the log line contents.
It may be possible to simply use the standard Java Logger
if your Dockerfile's image is gcr.io/google_appengine/java-compat
(the image used when you don't specify a Dockerfile) and simply use the gcloud preview app deploy
command (the name of this command will change in future) to deploy based on your WAR folder.
In such a case, using the standard Logger
class and it's method log()
would possibly be working if you set the log level appropriately, instead of just prefixing the intended level to the log line as can be seen in your output.
I'm unfamiliar with Spring itself and how you would instruct it to do this, as it seems you're not the one responsible for the way it's simply prefixing its intended log-level, but at the very least my answer consists of letting you know this is the key to getting the Developers Console logs to show properly in the event that you are using the java appengine docker image (gcr.io/google_appengine/java-compat
).
Upvotes: 1