Perf4j integration for Seam Framework


Available documentation:

Getting started guide

Maven configuration

For Maven projects it's required to add seam-perf4j dependency to application's pom.xml:


Thanks to OSS Repository Hosting provided by Sonatype Seam-Perf4j's JARs are available in Maven Central Repository. Above configuration in pom.xml should be enough to add a dependency to any application builds with Maven 2.

Note: Seam-Perf4j is designed to be used in applications that are using Seam itself. Seam's artifacts are not available in Central Maven Repository, so it is assumed everyone interested would have JBoss Maven repository configured in his/her settings.xml already. If not following repository should be added in settings.xml located in user's home directory:

    (... - some other repositories)

Seam configuration

It is required to register additional interceptor 'org.sf.seam.perf4j.Perf4jProfiledInterceptor' in components.xml in Seam application to profile. In there is registered some custom interceptor already it is enough to just add mentioned value into section, if not all default Seam interceptors have to registered directly. For Seam 2.2.0.GA it would be:


Application configuration

The last step is to annotate profiled method:

@Profiled(tag = "profiledMethodTag")
public void profiledMethod() {...}

Note: Due to Seam limitation in interceptors configuration in XML, it's required to use marker @Perf4jProfiled annotation to associate interceptor with a method in addition to original @Profiled annotation from Perf4j. Starting from version 0.4.0 @Profiled annotation can be omitted (logging with default values takes place then).

After execution of profiled method(s) you should be able to see message similar to following in the application log:

INFO  [org.perf4j.TimingLogger] start[1267557706784] time[1075] tag[profiledMethodTag]

Happy profiling with Seam and Perf4j!