2
votes

I'm checking out GAE Managed VMs using app.yaml, as described here https://cloud.google.com/appengine/docs/managed-vms/java/configuring-your-app-with-app-yaml

When I do

env_variables:
  java.util.logging.config.file: 'WEB-INF/logging.properties'

I get exception

google.appengine.api.yaml_errors.EventError: Value 'java.util.logging.config.file' for key in EnvironmentVariables does not match expression '^(?:[a-zA-Z_][a-zA-Z0-9_]*)$'

Is there any way to specify custom logging.properties through app.yaml?

3
I still haven't found the answer, but gcloud-maven plugin sources turned out to be extremely useful: github.com/GoogleCloudPlatform/gcloud-maven-plugin/tree/master/… Kudos to gcloud team for sources!Dzmitry Lazerka

3 Answers

1
votes

Try this:

env_variables:
  JAVA_USER_OPTS: -Djava.util.logging.config.file=webapps/root/WEB-INF/logging.properties

The env_variables section in app.yaml is for setting environment variables. Dots are not allowed in their names, so the exception makes sense.

You are trying to set java.util.logging.config.file, which is a system property, not an environment variable. To set it you need to provide -Djava.util.logging.config.file=<value> argument when starting Java. GAE Flexible image provides JAVA_USER_OPTS environment variable to customise Java command line, so you can use it to customise JUL settings (as is now also recommended in the image readme).

Also, WEB-INF/logging.properties value didn't work for me as the current dir is $JETTY_BASE, not $JETTY_BASE/webapps/root.

1
votes

The other answer is no longer correct. The property name is now named JAVA_OPTS

Full 'secret' variable names here https://github.com/GoogleCloudPlatform/jetty-runtime#providing-loggingproperties-via-the-web-application

This is the correct setting now:

env_variables:
  JAVA_OPTS: -Djava.util.logging.config.file=webapps/root/WEB-INF/logging.properties
1
votes

For the Generally Available Flexible Environment, use this format.

env_variables:
  JETTY_ARGS: -Djava.util.logging.config.file=WEB-INF/logging.properties

See here .