Update doc/java-agent.txt to reflect the new packaging
[deliverable/lttng-ust.git] / doc / java-agent.txt
CommitLineData
3707dfc5 1The agent can be built in three different configurations:
6f3cecd7
CB
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
3707dfc5
AM
23Enabling the JUL support will build a "lttng-ust-agent-jul.jar" file. Enabling
24the log4j support will build a "lttng-ust-agent-log4j.jar". Both of these jars
25depend on a third "lttng-ust-agent-common.jar", which will always be built.
6f3cecd7 26
3707dfc5
AM
27All these archives will be installed in the arch-agnostic "$prefix/share/java"
28path, e.g: "/usr/share/java". You need to make sure the .jar for the logging
29API you want to use (either lttng-ust-agent-jul.jar or -log4j.jar) is on your
30application's classpath.
6f3cecd7 31
3707dfc5
AM
32Both logging libraries also require an architecture-specific shared object
33(e.g: "liblttng-ust-jul-jni.so"), which is installed by the build system when
34doing "make install". Make sure that your Java application can find this shared
35object with the "java.library.path" property.
6f3cecd7
CB
36
37In order to enable the agent in your Java application, you simply have to add
38this as early as you can in the runtime process.
39
40import org.lttng.ust.agent.LTTngAgent;
41[...]
42 private static LTTngAgent lttngAgent;
43 [...]
44 lttngAgent = LTTngAgent.getLTTngAgent();
45
46This will initialize automatically the singleton LTTngAgent, and will
47return when the session daemon registration is done. If no session daemon is
48available, the execution will continue and the agent will retry every
493 seconds.
This page took 0.024989 seconds and 5 git commands to generate.