Labeling log output for a step

Create a label to have step output listed in its own category in the step log.

Before you begin

This task assumes that you have already created a selector, server, and project. It assumes that you are using a server with an operating system that accepts the echo command (for example, Windows, Linux, or UNIX).

About this task

You can include an uppercase label at the beginning of any line of output. The label is used until the step ends or a new label is encountered.

A label has the following syntax:

You can create a label using the echo command in a step. The system recognizes the first argument to the echo command as a label if it follows the label syntax.

Note: The system recognizes text at the beginning of a line in any build output as a label if it follows the syntax, even if that text is not an argument to the echo command.
As the example shows, you can set the label to an existing output label name as well as new names.

Procedure

  1. Create a new step in a project. The project in this example is named Say_hi.
  2. Name the step LabeledLogOutput.
  3. Enter the following text in the Command field:
    echo SPACESHIPS: Voyager I
    echo Voyager II
    echo EXEC: You can add text to existing categories as well
  4. Run the project.
  5. When the job completes, view the log.

Results

Note the SPACESHIPS checkbox in the category header and output lines 354 and 355, which are labeled SPACESHIPS.
79	    7/9/10 10:24 AM	EXEC	    Locale set to 'English_United States.1252'
250	  7/9/10 10:24 AM	EXEC	    Locale set to 'English_United States.1252'
349	  7/9/10 10:24 AM	EXEC	    Performing variable expansion on command line
353	  7/9/10 10:24 AM	EXEC	    start [C:\data\BuildForge\buildforge_projects\Say_hi\BUILD_1@RBF-14]
354	  7/9/10 10:24 AM	SPACESHIPS	      Voyager I
355	  7/9/10 10:24 AM	SPACESHIPS	      Voyager II
356	  7/9/10 10:24 AM	EXEC	     You can add text to existing categories as well
357	  7/9/10 10:24 AM	EXEC	    end [C:\data\BuildForge\buildforge_projects\Say_hi\BUILD_1@RBF-14]

Note: You can select or clear the SPACESHIPS check box to show or hide the category.
Note: When adding text to an EXEC category, be sure to avoid special characters (for example, parenthesis). On some systems, these can be viable if surrounded by quotes, but in general it is a better practice to simply use plain text.

Feedback