Simplified Installation

These steps should get you up and running directly. You can find a more verbose version of these instructions online at The Beet Tutorial. This configuration can be expanded and fine-tuned in many ways, see Chapter 3, Configuration Reference for details. The steps for a basic installation into an existing Spring application are:

  1. Download an appropriate release package from SourceForge.

  2. Add beet-core.jar and its dependency jars in lib/ to your application (e.g. in the WEB-INF/lib directory for WAR archives).

  3. Add behavior tracking markup to your Spring applicationContext.xml file (modify values to suit your application):

    Example 1.1. Adding method and http tracking to applicationContext.xml

    <beans xmlns="http://www.springframework.org/schema/beans"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xmlns:bt="http://beet.sourceforge.net/schema/bt/1.1"
           xsi:schemaLocation="
              http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
              http://beet.sourceforge.net/schema/bt/1.1         http://beet.sourceforge.net/schema/bt/mtgi-bt-1.1.xsd">
    
          <bt:manager application="myapp"1
          			  register-mbeans="true"2
                      track-method-expression="execution(* com.mtgi.analytics..*Tracked(..))"3>
             <bt:http-requests parameters="dispatch"/>4
          </bt:manager>

    1

    The name of this application, as it will appear in behavior tracking logs.

    2

    Optional mbean registration, if you plan to use a JMX tool like JConsole to monitor your application.

    3

    (optional) An AspectJ pointcut expression identifying which methods you want to track in your application. This example identifies "all methods in the com.mtgi.analytics package with names ending in "Tracked". For a detailed description of this grammar, see the AspectJ programming guide.

    4

    (optional) Enable limited HTTP request tracking. HTTP request tracking can also be enabled as a servlet filter with more fine-grained control. The "parameters" attribute is a comma-separated list of request parameters logged with each event.


  4. (optional) To enable behavior tracking at the SQL level, add a custom attribute to the data source declaration in your spring configuration:

    Example 1.2. Adding SQL tracking to applicationContext.xml

    <bean id="myDataSource" class="..." 
          bt:tracking-manager="defaultTrackingManager">1
    
       ... normal datasource configuration ... 
    
    </bean>

    1

    This name points back to an instance of the bt:manager element as described above, which is used to configure application-wide behavior tracking settings. This name is the id attribute of your bt:manager element, or defaultTrackingManager if bt:manager does not have an id.


EAR Deployments

Beet libraries can be deployed to a shared library location, either in the EAR or in your application server. If you want to include HTTP request tracking to a WAR module in your application, you should also add beet-web.jar to the WAR's WEB-INF/lib directory. beet-web.jar can be found in the beet distribution under web/. This step is not necessary if beet libraries are included directly in WEB-INF/lib.