Though Play does not require a lot of configuration to run, there has to be one file where basic information such as database connection strings, log levels, modules to enable additional functionality, supported application languages, or the setting of the application mode is configured. This file is conf/application.conf
, though it looks like a properties file, it really is not because of its UTF-8 encoding.
Just open conf/application.conf
with your any editor supporting UTF-8, be it Eclipse, Vim, textmate, or even notepad.
Now every configuration option follows the scheme:
# Some comment key = value
Notable for application start is the http.port
option, which runs your Play application per default on port 9000; this can be changed to any port above 1024 if you are a non-root user, which is highly recommended anyway.
By definition Java property files are ISO-8859-1 and nothing else. Play, however, is thought of as an everything-UTF-8 framework; hence, the application configuration filename does not have a .properties
suffix. For more info about standard Java properties, please refer to:
http://download.oracle.com/javase/6/docs/api/java/util/Properties.html
As the documentation covers most of the possible parameters in the configuration file pretty well, this file will only be mentioned if the default configuration has to be changed.
Most importantly, adding and configuring modules in order to enhance the basic functionality of Play is part of the application.conf
, and each module requires enabling it via defining its path:
module.foo=${play.path}/modules/foo
After starting your Play application, the console output should include information about which of your configured modules have been loaded successfully.
Another important setup is the log level of your application when using log4j
, which is used by Play framework all over the place. When in production mode, it should be set to INFO or ERROR; however, in testing mode the following line might help you to discover problems:
application.log=DEBUG
We will refer to the application.conf
file when setting up special databases later on in this chapter. Also there is an own Configuring log4j for log rotation recipe in the Chapter 7, Running in Production.
3.145.12.156