Fix: context alignment not properly handled
[lttng-ust.git] / doc / java-agent.txt
CommitLineData
c71dfbd5
CB
1The agent can now be built in three different configurations:
2
31) Java agent with JUL support:
4
5$ ./configure --enable-java-agent-jul
6
72) Java agent with Log4j support:
8
9$ export CLASSPATH=$CLASSPATH:/path/to/log4j.jar
10$ ./configure --enable-java-agent-log4j
11
123) Java agent with JUL + Log4j support
13
14$ export CLASSPATH=$CLASSPATH:/path/to/log4j.jar
15$ ./configure --enable-java-agent-all
16
17To build the agent with log4j support, make sure that the log4j jar
18is in your Java classpath.
19
20The configure script will automatically detect the appropriate Java
21binaries to use in order to build the Java agent.
22
23The name of the agent jar file is now "liblttng-ust-agent.jar".
24It will be installed in the arch-agnostic "$prefix/share/java" path
25e.g: "/usr/share/java".
26
27In order to support older applications using the "org.lttng.ust.jul"
28package, a transitional package is built with the same name.
29
30All applications should move to use the "org.lttng.ust.agent" package.
31
32After building, you can use the "liblttng-ust-agent.jar" file in a
33Java project. Depending on your configuration, the agent will
34requires shared objects (e.g: "liblttng-ust-jul.so") which is installed
35by the build system when doing "make install". Make sure that your
36Java application can find this shared object with the
37"java.library.path".
38
39In order to enable the agent in your Java application, you simply have to add
40this as early as you can in the runtime process.
41
42import org.lttng.ust.agent.LTTngAgent;
43[...]
44 private static LTTngAgent lttngAgent;
45 [...]
46 lttngAgent = LTTngAgent.getLTTngAgent();
47
48This will initialize automatically the singleton LTTngAgent, and will
49return when the session daemon registration is done. If no session daemon is
50available, the execution will continue and the agent will retry every
513 seconds.
This page took 0.023672 seconds and 4 git commands to generate.