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