| This Tuscany sample shows how to implement and use a simple Logger component |
| that logs string messages to a Scribe logging server. |
| |
| Scribe is an Open Source server for aggregating streaming log data. It is |
| designed to scale to a very large number of nodes and be robust to network |
| and node failures. |
| |
| See the Scribe Wiki [1] for more information on Scribe. |
| |
| Getting the required Apache Thrift library |
| ========================================== |
| This sample uses Apache Thrift's libthrift.jar to communicate with Scribe |
| servers. Libthrift is not yet available in a Maven repository, so before |
| building the sample with Maven, you need to download libthrift [2] and |
| install it in your local Maven repository like this: |
| |
| mvn install:install-file -DgroupId=org.apache.thrift -DartifactId=libthrift \ |
| -Dversion=1.0-SNAPSHOT -Dpackaging=jar -Dfile=libthrift-r917130.jar |
| |
| Starting a Scribe server |
| ======================== |
| Before running the LoggingTest sample test program, you need to start a Scribe |
| server for the sample program to connect to. |
| |
| Steps to start a Scribe server are described in the Scribe examples README [3]. |
| A simple Scribe server configuration can be found in the Scribe examples [4]. |
| |
| LoggingTest will try to connect to a Scribe server at localhost:1463. To use |
| a Scribe server at a different host or port, configure the host and port |
| properties in scribe.composite to match your server. |
| |
| Running the LoggingTest sample test program |
| =========================================== |
| |
| To run the LoggingTest sample test program, do this: |
| mvn -Dtest=LoggingTest test |
| |
| Checking the Scribe log output |
| ============================== |
| After running LoggingTest, you should find the logged string "Hello There" in |
| file sample/sample_current under your Scribe log store directory. |
| |
| If you've used the example1.conf Scribe configuration from the Scribe examples |
| [4], you should find your log message in /tmp/scribetest/sample/sample_current. |
| |
| |
| [1] http://wiki.github.com/facebook/scribe/ |
| [2] http://svn.apache.org/repos/asf/cassandra/trunk/lib/libthrift-r917130.jar |
| [3] http://github.com/facebook/scribe/blob/master/examples/README |
| [4] http://github.com/facebook/scribe/blob/master/examples/example1.conf |
| |