2

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?

Justin Beckwith
  • 7,686
  • 1
  • 33
  • 55
Dzmitry Lazerka
  • 1,809
  • 2
  • 21
  • 37
  • 1
    I still haven't found the answer, but gcloud-maven plugin sources turned out to be extremely useful: https://github.com/GoogleCloudPlatform/gcloud-maven-plugin/tree/master/src/main/java/com/google/appengine/gcloudapp Kudos to gcloud team for sources! – Dzmitry Lazerka Mar 06 '16 at 08:52

3 Answers3

1

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.

Das
  • 317
  • 2
  • 8
  • 14
  • Correction, note this JETTY_ARGS: -Djava.util.logging.config.file=WEB-INF/logging.properties https://github.com/GoogleCloudPlatform/jetty-runtime#providing-loggingproperties-via-the-web-application – Joshua Fox Dec 10 '17 at 08:43
1

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
Celandro
  • 51
  • 5
  • Apparently this is also incorrect. See https://github.com/GoogleCloudPlatform/jetty-runtime#providing-loggingproperties-via-the-web-application – Joshua Fox Dec 10 '17 at 08:46
1

For the Generally Available Flexible Environment, use this format.

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

See here .

Joshua Fox
  • 18,704
  • 23
  • 87
  • 147