Skip to content
This repository has been archived by the owner on Dec 12, 2024. It is now read-only.

How to specify JUL logging configuration properties file #101

Open
meltsufin opened this issue Dec 19, 2016 · 5 comments
Open

How to specify JUL logging configuration properties file #101

meltsufin opened this issue Dec 19, 2016 · 5 comments
Labels

Comments

@meltsufin
Copy link
Member

Re-posting a direct query from user:

In App Engine Standard, we used to have this in appengine-web.xml but now in app.yaml

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

It doesn’t seem to work however, INFO messages are still logged, even though it is set to WARNING.

@meltsufin
Copy link
Member Author

I think part of the problem is that in Flex, there is nothing that is reading and propagating system_properties to the JVM.

@meltsufin
Copy link
Member Author

With a custom Dockerfile, a workaround is to add the following line, specifying the location of the logging.properties for JUL:

CMD ["java","-Djetty.base=/var/lib/jetty","-Djava.util.logging.config.file=/var/lib/jetty/webapps/root/WEB-INF/logging.properties","-jar","/usr/local/jetty/start.jar"]

@gregw
Copy link
Contributor

gregw commented Dec 22, 2016

See also the #81 PR for #68, which implements JUL for the container and also set's this property.

Because JUL is provided by the JVM, it is a not a logging mechanism that can be easily hidden/separated between the container and application. So eventually we will be providing a JUL setup that the application will see. To configure this, they will have to manipulate the properties file that will be provided by the image, rather than provide their own and point the java.util.logging.config.file elsewhere.

In compat, the JUL was programmatically configured to ensure the container configuration is applied, however this results in a very non standard lifecycle for JUL.

Thus I think it would be better to establish the precedent that the jetty-runtime (maybe even openjdk-runtime) will setup JUL for you and then applications will modify that setup rather than do their own.

@meltsufin
Copy link
Member Author

I forgot to update this issue with a better solution that currently works, which is to pass additional JVM arguments through an environment variable that can be specified in app.yaml.
Instead of the CMD in Dockerfile, you can use this in app.yaml:

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

This also reminds me that we should consider setting the working directory to the web root, so that users can just use relative paths:

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

@meltsufin
Copy link
Member Author

@gregw Regarding what you said about manipulating a properties file that will be provided by the image, is this something that will require a custom Dockerfile?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants