<div dir="ltr">Wow, thanks for quickly dealing with this issue!<br><br>Glen.</div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Feb 4, 2015 at 10:46 PM, Mathieu Desnoyers <span dir="ltr"><<a href="mailto:mathieu.desnoyers@efficios.com" target="_blank">mathieu.desnoyers@efficios.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="font-family:times new roman,new york,times,serif;font-size:12pt;color:#000000"><hr><blockquote style="border-left:2px solid #1010ff;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt"><b>From: </b>"Mathieu Desnoyers" <<a href="mailto:mathieu.desnoyers@efficios.com" target="_blank">mathieu.desnoyers@efficios.com</a>><br><b>To: </b>"Glen Keane" <<a href="mailto:glenkeane.94@gmail.com" target="_blank">glenkeane.94@gmail.com</a>><br><b>Cc: </b><a href="mailto:lttng-dev@lists.lttng.org" target="_blank">lttng-dev@lists.lttng.org</a><br><b>Sent: </b>Wednesday, February 4, 2015 12:11:39 PM<br><b>Subject: </b>Re: [lttng-dev] Printing to stdout and stderr from the        userspace        library.<div><div class="h5"><br><div><br></div><div style="font-family:times new roman,new york,times,serif;font-size:12pt;color:#000000"><hr><blockquote style="border-left:2px solid #1010ff;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt"><b>From: </b>"Glen Keane" <<a href="mailto:glenkeane.94@gmail.com" target="_blank">glenkeane.94@gmail.com</a>><br><b>To: </b><a href="mailto:lttng-dev@lists.lttng.org" target="_blank">lttng-dev@lists.lttng.org</a><br><b>Sent: </b>Wednesday, February 4, 2015 10:13:06 AM<br><b>Subject: </b>[lttng-dev] Printing to stdout and stderr from the userspace        library.<br><div><br></div><div dir="ltr">Hey Everybody,<br><div><br></div>I'm currently working on getting Lttng tracepoints into node.js/iojs. iojs is a downstream fork of node.js, which I personally hope will be merged back into node.js, which will then include all my tracing work from iojs. I'm currently having some trouble with lttng userspace library printing to stdout/stderr from iojs however.<br><div><br></div>I currently have a pull request issued on the iojs core (<a href="https://github.com/iojs/io.js/pull/702" target="_blank">https://github.com/iojs/io.js/pull/702</a>) and this could hopefully mean we will get lttng tracepoints into the project! :)<br><div><br></div>I have hit an issue with my pull request, however. If you follow the link above you can see @bnoordhuis asked me about a test which I had to modify for this pull request. This particular test passes some variables to a child process, the child prints the variables to stdout/stderr, and the parent takes a pipe of the childs stdout/stderr and compares it to an expected stdout/stderr, and asserts they match. If they don't match, its a catastrophic failure and that single test fails.<br><div><br></div>The issue here is that when you spawn a child process in node.js and pass it a custom ENV variable, the ENV variables available to the child process will not have access to any of the ENV variables of the parent process. This means there is no LTTNG_HOME or HOME env variables available to the child process. This then in turn means that when lttng's userspace library is instantiated it doesn't have access to either of those variables and spits out this warning to stderr:<br><div><br></div><span style="font-family:monospace,monospace">Warning: HOME environment variable not set. Disabling LTTng-UST per-user tracing.<br></span><br>I accept this warning is warranted, as there is no tracing location available to the child process so therefore it cannot be traced, but it means that the test fails, as it does not expect this error to printed to stderr. I am looking for a way to silence the output of the library so this test doesn't need to be modified, and so I don't have to implicitly pass a child process the ENV HOME variable or LTTNG-HOME variable. The ability to clear all env variables being passed to a child is a design choice which is acceptable behaviour of io.js.<br><div><br></div>I did not expect a library to print to stderr/stdout however, and I feel that this is something that may need to approached and rectified. </div></blockquote><div><br></div><div>It makes sense to move the output of this library somewhere else than the console, but where,<br></div><div>and how could we override the behavior without adding an environment variable, which seems<br></div><div>to be impossible to use in your use-case ?</div></div></div></div></blockquote><div>Issue taken care of in lttng-ust master by only showing the lttng-ust library<br></div><div>error output when either:<br></div><div><br></div><div>LTTNG_UST_DEBUG env. var. is set, or LTTNG_UST_DEBUG<br></div><div>is defined at library compile-time.<br></div><div><br></div><div>See the following commits:<br></div><div><br></div><div>commit d14c063ab40215ec3c99e7b68483a5e170121a09<br>Author: Mathieu Desnoyers <<a href="mailto:mathieu.desnoyers@efficios.com" target="_blank">mathieu.desnoyers@efficios.com</a>><br>Date:   Wed Feb 4 17:41:32 2015 -0500<br><br>    Update manpage about LTTNG_UST_DEBUG effect<br>    <br>    Signed-off-by: Mathieu Desnoyers <<a href="mailto:mathieu.desnoyers@efficios.com" target="_blank">mathieu.desnoyers@efficios.com</a>><br><br>commit 7bdd21a41092a59207958911666cbd458f93a319<br>Author: Mathieu Desnoyers <<a href="mailto:mathieu.desnoyers@efficios.com" target="_blank">mathieu.desnoyers@efficios.com</a>><br>Date:   Wed Feb 4 17:39:01 2015 -0500<br><br>    Don't output to stderr from lib unless DEBUG is activated<br>    <br>    Signed-off-by: Mathieu Desnoyers <<a href="mailto:mathieu.desnoyers@efficios.com" target="_blank">mathieu.desnoyers@efficios.com</a>><br><br>commit eb2b066ff35dcafa727fae7e8853a9750233063e<br>Author: Mathieu Desnoyers <<a href="mailto:mathieu.desnoyers@efficios.com" target="_blank">mathieu.desnoyers@efficios.com</a>><br>Date:   Wed Feb 4 17:33:59 2015 -0500<br><br>    Remove usterr.h, use usterr-signal-safe.h everywhere instead<br>    <br>    Remove minimally used code.<br>    <br>    Signed-off-by: Mathieu Desnoyers <<a href="mailto:mathieu.desnoyers@efficios.com" target="_blank">mathieu.desnoyers@efficios.com</a>><br><br></div><div>Since this is a behavior change, it stay in master until the<br></div><div>next LTTng release cycle (2.7).<br></div><div><br></div><div>Feedback is welcome,<br></div><div><br></div><div>Thanks!<span class="HOEnZb"><font color="#888888"><br></font></span></div><span class="HOEnZb"><font color="#888888"><div><br></div><div>Mathieu<br></div></font></span><span class=""><blockquote style="border-left:2px solid #1010ff;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt"><div style="font-family:times new roman,new york,times,serif;font-size:12pt;color:#000000"><div><br></div><div><br></div><div>Thoughts ?<br></div><div><br></div><div>Thanks,<br></div><div><br></div><div>Mathieu<br></div><div><br></div><blockquote style="border-left:2px solid #1010ff;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt"><div dir="ltr"><div><br></div>Thanks for reading,<br>Glen Keane.<br></div><br>_______________________________________________<br>lttng-dev mailing list<br><a href="mailto:lttng-dev@lists.lttng.org" target="_blank">lttng-dev@lists.lttng.org</a><br><a href="http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev" target="_blank">http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev</a><br></blockquote><div><br><div><br></div></div><div><br></div><div>-- <br></div><div>Mathieu Desnoyers<br>EfficiOS Inc.<br><a href="http://www.efficios.com" target="_blank">http://www.efficios.com</a><br></div></div><br>_______________________________________________<br>lttng-dev mailing list<br><a href="mailto:lttng-dev@lists.lttng.org" target="_blank">lttng-dev@lists.lttng.org</a><br><a href="http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev" target="_blank">http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev</a><br></blockquote><div><br><br></div><div><br></div><div>-- <br></div><div><span name="x"></span>Mathieu Desnoyers<br>EfficiOS Inc.<br><a href="http://www.efficios.com" target="_blank">http://www.efficios.com</a><span name="x"></span><br></div></span></div></div></blockquote></div><br></div>