Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

When an @Monitor annotation is encountered, the Fabric3 runtime will generate a monitor proxy and inject it based on the monitor interface. Depending on the current monitor level, events may be recorded or ignored. In the above example, if the monitor level is set to severe, the receivedRequest() event will be dropped.

Configuration

Monitor events are sent routed to a destination.  A destination has one or more appenders that act as sinks for monitor events. It is possible to create a custom appender (detailed below) or use one of the provided appenders such as the file or console appenders. An application (or service) can send events to a custom destination or use the default runtime destination. Sending events to a custom destinations allows traffic for a particular application, subsystem or service to be segmented from other events.  

Runtime Specific Behavior

The Fabric3 monitor framework uses different implementations depending on the host environment. For WebLogic, Maven and Ant, the native host logging framework is used. For example, on WebLogic, monitor proxies will forward events to WebLogic's logging infrastructure. Configuration is therefore specific to each host environment.  The Fabric3 Standalone and Tomcat runtimes use the native Fabric3 monitoring implementation, which is described in the rest of this section.

Configuring the Runtime Destination

The default runtime destination is where Fabric3 runtime events (and application events if not specified) are sent. The default destination can be configured in systemConfig.xml , for example, to record events to a log file instead of outputting to the console. The monitor element is used to add appenders 

...

This is done by adding appender entires under the monitor element in systemConfig.xml:

 

Code Block
languagehtml/xml
<monitor>
   <appenders>
       <appender.file file="fabric3.log"/>
       <appender.console/> 
    </appenders>
</monitor>

The above example configures both a console and file appender. The file attribute is the location of the output file, which is relative to the runtime /data directory (subdirectories are supported).

Configuring Custom Destinations

As mentioned previously, it is possible to setup custom destinations to segment event traffic. This is done by including a monitor entry in a composite file. The following example is taken from the monitor sample application:

Code Block
languagehtml/xml
<composite .... xmlns:f3="urn:fabric3.org">    

...

Configuring Custom Destinations

 

Ring Buffer Destinations

...


 
   <f3:monitor name="ApplicationDestination">
      <appenders>
         <appender.file file="application.log"/>
      </appenders>
   </f3:monitor>

</composite>
 

Application code can then reference the destination by specifying its name in the @Monitor annotation:

Code Block
languagejava
public class SomeComponent ... {
   @Monitor("ApplicationDestination") 
   protected ServiceMonitor monitor;

    public void process() {
       ...
       monitor.message("This is a message");
    }
}

Asynchronous Monitoring with Ring Buffers

By default, monitor events are sent synchronously.  


<f3:monitor name="ApplicationDestination" mode="asynchronous" capacity="3000" proxy="bytecode" timestamp="formatted">
<appenders>
<appender.file file="application.log"/>
<appender.console/>
<!-- uncomment the following line to use the sample monitor extension. The fabric3-samples-monitor-extension jar produced by the monitor-extension
module must be deployed to the runtime as an extension. -->
<!--<appender.component name="SampleFileAppender"/>-->
</appenders>
</f3:monitor>

Custom Appenders

Configuration Reference

...