Documentation Home

Flume Developer Guide

flume-dev@cloudera.org

Revision History
Revision 0.9.4-cdh4.1.2November 1 2012F

Table of Contents

1. Logging
1.1. Setting Up Logging
1.2. Logging Exceptions
1.3. Logging Formatting and Performance Notes
2. Running Tests
3. Writing Documentation

1. Logging

Logging is implemented using the SLF4J API.

Be sure to read the SLF4J documentation.

1.1. Setting Up Logging

Typically each class has its own logger. We declare these as follows:

private static final Logger LOG = LoggerFactory.getLogger(MyClass.class);

Things to note here:

  • We make all loggers private static final (and in that order).
  • We name all of our loggers LOG.
  • We just pass the class, we don’t call .getName() on the class.

1.2. Logging Exceptions

We are using the 1.6 version of SLF4J, so we get to take advantage of the improved support for logging exceptions.

1.3. Logging Formatting and Performance Notes

For a good discussion of this, see the relevant section in the SLF4J FAQ.

2. Running Tests

The core suite of tests (located in src/javatest) can be run by using ant test.

To run only a specific test class, you can add a special argument to the command line: ant test -Dtestcase=<TestClass> where <TestClass> is the name of a unit test class.

Sometimes you may want to run all tests except for a few specific ones (flaky tests perhaps). This can be done by running ant test -Dtest.exclude.file=<file>

Sometimes you may want to run only a selected set of tests. This can be done by running ant test -Dtest.include.file=<file>

In both of these cases the tests are specified line by line in ant fileset format. The following example will recursively select all files that start with TestFoo.

**/TestFoo*

3. Writing Documentation

Documentation is written using AsciiDoc.

     ______
    / ___//_  ______  ____
   / /_/ / / / /    \/ __/
  / __/ / /_/ / / / / __/
 / / /_/\____/_/_/_/\__/
/_/ Distributed Log Collection.