Dear Alex, Thanks for your attention. I executed your commands step by step. While, again I received previous errors which are [error] Cannot open any trace for reading.[error] opening trace "[path]/lttng-traces/auto-20171011-145947" for reading. [error] none of the specified trace paths could be opened.
I do not know the reason of this problem. Could you please help me to resolve it? Regards,Mehdi. On Wednesday, October 11, 2017, 6:09:41 PM GMT+3:30, Alexandre Montplaisir <alexmon...@voxpopuli.im> wrote: Hi, I tried compiling and running your program, and it runs fine on my end. Here is what I did: saved the snippet below to "Hello.java" $ apt install liblttng-ust-agent-java $ javac -cp /usr/share/java/lttng-ust-agent-jul.jar Hello.java $ lttng create $ lttng enable-event -a -j $ lttng start $ java -cp /usr/share/java/lttng-ust-agent-jul.jar:. Hello $ lttng stop $ lttng view and I get the following output: Trace directory: /home/alexandre/lttng-traces/auto-20171011-102431 [10:24:49.326824061] (+?.?????????) calista lttng_jul:event: { cpu_id = 2 }, { msg = "Hello World, the answer is 42", logger_name = "hello", class_name = "Hello", method_name = "main", long_millis = 1507731889299, int_loglevel = 800, int_threadid = 1 } Make sure you are setting the -classpath/-cp option correctly, this could explain the "unknown package" error you were getting. Also note that you are using the deprecated "LTTngAgent.getLTTngAgent()" API (the "javac" command should warn about it). It should still work, but it's highly recommended to use the new API, as described in https://lttng.org/docs/v2.10/#doc-jul . Basically you have to instantiate an "LttngLogHandler", and attach it to your Logger. HTH, Alex On 2017-10-10 04:12 PM, MMM via lttng-dev wrote: > Dear Philippe, > > Thanks a lot for your consideration. I solved former problem. While, I > faced with a new problem. Indeed, when I create a LTTng session, start > it and finally stop LTTng, I could not find trace files in mentioned > folder. My java code is > > /////////////////////////////////////// > import java.io.IOException; > import java.util.logging.Handler; > import java.util.logging.Logger; > > import org.lttng.ust.agent.LTTngAgent; > import org.lttng.ust.agent.jul.LttngLogHandler; > > public class Hello { > private static final int answer = 42; > private static LTTngAgent lttngAgent; > > public static void main(String[] args) throws InterruptedException { > Logger helloLog = Logger.getLogger("hello"); > lttngAgent = LTTngAgent.getLTTngAgent(); > > Thread.sleep(5000); > helloLog.info("Hello World, the answer is " + answer); > lttngAgent.dispose(); > } > > } > /////////////////////// > > Also, I used following LTTng commands. > > //////////////////////////////// > lttng create java-test > lttng enable-event -a -l > lttng start > ///Start My java Application/// > lttng stop > //////////////////////////// > > Besides, when I used "lttng view" after stopping LTTng, I received > following error message > > [error] Cannot open any trace for reading. > [error] opening trace > "/[path]/lttng-traces/java-test10-20171010-130909" for reading. > [error] none of the specified trace paths could be opened. > > Could you please help me to resolve it. > > Regards, > Mehdi. > > > > > > > On Monday, October 9, 2017, 1:05:59 AM GMT+3:30, Philippe Proulx > <eeppelitel...@gmail.com> wrote: > > > On Sun, Oct 8, 2017 at 4:15 PM, MMM via lttng-dev > <lttng-dev@lists.lttng.org <mailto:lttng-dev@lists.lttng.org>> wrote: > > Dear Users, > > > > I am beginner in tracing using LTTng. At present, I am going to > trace a java > > program in Ubuntu, while I faced with a problem. When I install > LTTng on > > Ubuntu, I also install > > > > "liblttng-ust-agent-java" by "apt-get install liblttng-ust-agent-java" > > command in Ubuntu. But, when I want to import any libraries related > to LTTng > > such as > "org.lttng.ust.agent.jul.LttngLogHandlerorg.lttng.ust.LTTngAgent" to > > my program, it is marked as unknown package. Indeed, I could not > find LTTng > > Jar file for adding it to my program libraries. Furthermore, I > searched in > > all files and folders, while I could not find Jar file. Could you please > > help me to understand the cause of this problem and solve it. > > I'm not a Ubuntu specialist, but from > <https://packages.ubuntu.com/zesty/all/liblttng-ust-agent-java/filelist>, > I would say: > > * /usr/share/java/lttng-ust-agent-jul.jar > * /usr/share/java/lttng-ust-agent-log4j.jar > > On 16.04, it's: > > * /usr/share/java/liblttng-ust-agent.jar > > Add the required JAR file to your classpath. > > Have a look at <http://lttng.org/docs/v2.9/#doc-java-application>. > > Phil > > > > > > > > Best regards, > > > > Mehdi. > > > > > > _______________________________________________ > > lttng-dev mailing list > > lttng-dev@lists.lttng.org <mailto:lttng-dev@lists.lttng.org> > > https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev > > > > > _______________________________________________ > lttng-dev mailing list > lttng-dev@lists.lttng.org > https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
_______________________________________________ lttng-dev mailing list lttng-dev@lists.lttng.org https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev