Commit | Line | Data |
---|---|---|
6490eba0 MD |
1 | The support for JUL needs to be explicitly enabled when lttng-ust is |
2 | configured, e.g.: | |
43e5396b DG |
3 | |
4 | dependency: openjdk-7-jdk | |
5 | ./configure --with-java-jdk=/usr/lib/jvm/java-7-openjdk --with-jni-interface | |
6 | ||
7 | On Debian system for instance you can simply use the "default-java" path: | |
8 | ||
9 | ./configure --with-java-jdk=/usr/lib/jvm/default-java --with-jni-interface | |
10 | ||
11 | Note that the OpenJDK 7 is used for development and continuous integration thus | |
12 | we directly support that version for this library. However, it has been tested | |
13 | with OpenJDK 6 also. Please let us know if other Java version (commercial or | |
14 | not) work with this library. | |
15 | ||
6490eba0 MD |
16 | The LTTng Java Agent for JUL support is typically installed here: |
17 | ||
18 | /usr/local/lib/lttng/java/liblttng-ust-jul.jar | |
19 | ||
43e5396b DG |
20 | After building, you can use the "liblttng-ust-jul.jar" file in a Java project. |
21 | It requires "liblttng-ust-jul.so" which is installed by the build system when | |
22 | doing "make install". Make sure that your Java application can find this shared | |
23 | object with the "java.library.path". | |
24 | ||
25 | In order to enable the agent in your Java application, you simply have to add | |
26 | this as early as you can in the runtime process. | |
27 | ||
28 | import org.lttng.ust.jul.LTTngAgent; | |
29 | [...] | |
30 | private static LTTngAgent lttngAgent; | |
31 | [...] | |
32 | lttngAgent = LTTngAgent.getLTTngAgent(); | |
33 | ||
6490eba0 MD |
34 | This will initialize automatically the singleton LTTngAgent, and will |
35 | return when session daemon registration is done. If no session daemon is | |
36 | available, the execution will continue and the agent will retry every | |
37 | 3 seconds. | |
43e5396b DG |
38 | |
39 | Once registered, it is adds a thread inside your Java application and will be | |
40 | able to automatically use every Logger object and map them to the jul_event | |
6490eba0 | 41 | tracepoint of the JNI interface. |