Viewing properties defined in a properties file

If your project contain properties files, you may want to view their content. For instance, when we created the flight-app Roo project earlier, a log4j.properties file containing logging configuration was also created. In this recipe, we will look at the properties list command to view the contents of the log4j.properties file.

Getting ready

Start the Roo shell from C: oo-cookbookch01-recipe directory, which contains the flight-app Roo project.

How to do it...

To view the contents of a properties file, the properties list command requires a path to the properties file and its name. The following properties list command displays the contents of the log4j.properties file:

roo> properties list --name log4j.properties --path SRC_MAIN_RESOURCES

log4j.appender.R = org.apache.log4j.RollingFileAppender
log4j.appender.R.File = application.log
...
log4j.logger.sample.roo.flightapp = DEBUG
log4j.rootLogger = DEBUG, stdout

How it works...

The Properties file add-on is responsible for processing the properties list command. The following table describes the arguments it accepts:

Argument

Purpose

path

It is a mandatory argument that identifies a path to the properties file. It only accepts pre-defined values like ROOT, SPRING_CONFIG_ROOT, SCR_MAIN_WEBAPP, and so on.

name

It is a mandatory argument that specifies the name of the properties file whose content you want to view.

See also

  • The next recipe, Managing properties defined in a properties file, shows how you can add, remove, and modify properties defined in properties files in your Roo project.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.8.8