Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Spring Roo 1.1 Cookbook
  • Table Of Contents Toc
Spring Roo 1.1 Cookbook

Spring Roo 1.1 Cookbook

4.7 (3)
close
close
Spring Roo 1.1 Cookbook

Spring Roo 1.1 Cookbook

4.7 (3)

Overview of this book

Spring Roo is an easy-to-use productivity tool for rapidly developing Java enterprise applications using well-recognized frameworks such as Spring, Hibernate, AspectJ, Spring Web Flow, Spring Security, GWT, and so on. Spring Roo takes care of creating maven-enabled projects, enterprise application architecture based on your choice of technologies, unit/integration tests based on your choice of testing framework, and so on. The bottom line is that if you're using Spring, then you must consider using Spring Roo for increased productivity. Spring Roo 1.1 Cookbook brings together a collection of recipes that demonstrate how the Spring Roo developer tool simplifies rapidly developing enterprise applications using standard technologies/frameworks such as JPA, GWT, Spring, Flex, Spring Web Flow, Spring Security, and so on. It introduces readers to developing enterprise applications for the real world using Spring Roo tool. The book starts off with basic recipes to make readers comfortable with using Spring Roo tool. As the book progresses, readers are introduced to more sophisticated features supported by Spring Roo in the context of a Flight Booking application. In a step-by-step by fashion, each recipe shows how a particular activity is performed, what Spring Roo does when a command is executed, and why it is important in the context of the application being developed. Initially, you make a quick start with using Spring Roo through some simple recipes. Then you learn how Spring Roo simplifies creating the persistence layer of an enterprise application using JPA. You are introduced to the various roo commands to create JPA entities, create relationships between JPA entities, create integration tests using Spring TestContext framework, and so on. Following this, the book shows you how Spring Roo simplifies creating the web layer of an enterprise application using Spring Web MVC, Spring Web Flow, and how to create selenium tests for controller objects. Subsequently, we focus on using Spring-BlazeDS, GWT, JSON, and so on. Spring Roo commands that are used to incorporate e-mail/messaging features into an enterprise application are demonstrated next. Finally, we wrap it up with some miscellaneous recipes that show how to extend Spring Roo via add-ons, incorporate security, create cloud-ready applications, remove Spring Roo from your enterprise application, and so on.
Table of Contents (14 chapters)
close
close
Spring Roo 1.1 Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
1
Index

Configuring logging


In the Creating a Roo project recipe, you saw that when you create a new project, a log4j.properties file is automatically created with default logging configuration. In most real projects, you'd like to customize the default logging configuration. By default, the log4j.properties file configures root logger at ERROR level and logging is not enabled for the project.

In this recipe, we will look at the logging setup command to modify the logging configuration.

Getting ready

Start the Roo shell from the C:\roo-cookbook\ch01-recipe directory, which contains the flight-app Roo project.

How to do it...

Using the logging setup command you can specify the logging level and the package to which it applies, as shown in the following steps:

  1. The following logging setup commands are used to change the logging level of rootLogger to DEBUG (which is ERROR by default) and enable DEBUG level logging for all classes in the flight-app application:

    roo> logging setup --level DEBUG --package ROOT
    Updated SRC_MAIN_RESOURCES\log4j.properties
    
    roo> logging setup --level DEBUG --package PROJECT
    Updated SRC_MAIN_RESOURCES\log4j.properties
    

    As the output from the command execution suggests, some changes have been made by Roo to the log4j.properties file.

    Tip

    Keep an eye on the output of a command

    When a Roo command is executed, it displays information about what files and directories have been created or which files have been updated. This can be helpful if you want to check the code that is generated on execution of a command.

  2. To confirm that the changes have been made to the log4j.properties, you can either view it directly by opening the file or you can use the properties list command (explained in the next recipe).

How it works...

The logging setup command is processed by the Logging add-on of Spring Roo. The following table describes the arguments that the logging setup command accepts:

Argument

Purpose

level

This is a mandatory argument, which identifies the logging level. It can only take one of the pre-defined values, like DEBUG, ERROR, INFO, and so on.

package

This is an optional argument, which specifies the package to which the logging level applies. It can only take one of the pre-defined values, such as PROJECT, ALL_SPRING, PERSISTENCE, and so on.

There's more...

As of Spring Roo 1.1.3, using the logging setup command you can't specify a custom package name as the value of the package argument; therefore, you can set a custom package name either by using the properties set command (explained later in this chapter) or by directly editing the log4j.properties file.

See also

  • The Viewing properties defined in a properties file, Removing a property defined in a properties file, and Adding properties to a properties file recipes show how you can manage properties files in your Roo project.

CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Spring Roo 1.1 Cookbook
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon