<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Nov 3, 2017 at 1:03 AM, Lubomir I. Ivanov <span dir="ltr"><<a href="mailto:neolit123@gmail.com" target="_blank">neolit123@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 2 November 2017 at 22:39, Dirk Hohndel <<a href="mailto:dirk@hohndel.org">dirk@hohndel.org</a>> wrote:<br>
</span><span class="">> Sorry, from memory / on my phone. If the app is a console app, the code to redirect is never executed. So for the apps we ship, I believe this doesn't work. At least it didn't when I tried last week. Error could of course be mine... Look at the code... The redirect is inside an if clause and we never got to that code...<br>
><br>
<br>
</span><a href="https://github.com/Subsurface-divelog/subsurface/pull/763" rel="noreferrer" target="_blank">https://github.com/Subsurface-<wbr>divelog/subsurface/pull/763</a><br>
<br>
i wasn't able to write to a single log file, thus we still have the<br>
separate _err.log and _out.log files on win32.<br>
spent 1.5 hours on this alone.<br>
<br>
for a standalone C app this works:<br>
------------------------------<wbr>-----<br>
int logfile = open("subsurface.log", O_CREAT | O_WRONLY); // tried<br>
with S_IREAD | S_IWRITE too for p.bits.<br>
close(STDOUT_FILENO);<br>
close(STDERR_FILENO);<br>
dup2(logfile, STDOUT_FILENO);<br>
dup2(logfile, STDERR_FILENO);<br>
setbuf(stdout, NULL);<br>
setbuf(stderr, NULL);<br>
<br>
// from this point on, stdout and stderr are both written to the .log file<br>
------------------------------<wbr>-----<br>
<br>
in the case of subsurface, the log file is created, with OK<br>
permissions, but remains empty.<br>
maybe Qt is doing something to prevent this - no idea.<br></blockquote><div><br></div><div>Probably.</div><div>in the case of qDebugs / qCDebugs we can create a function to intercept the calls and write the logs, I'm unsure about printf.<br></div><div>I think Qt does the same as you did in the code example, so it also redirects to somewhere.</div><div><br></div><div>the code to intercept the qDebug calls already exist on mobile builds, if I remember correctly.</div><div>look for installMessageHandler</div><div><br></div><div>Tomaz<br></div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
lubomir<br>
--<br>
<div class="HOEnZb"><div class="h5">______________________________<wbr>_________________<br>
subsurface mailing list<br>
<a href="mailto:subsurface@subsurface-divelog.org">subsurface@subsurface-divelog.<wbr>org</a><br>
<a href="http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface" rel="noreferrer" target="_blank">http://lists.subsurface-<wbr>divelog.org/cgi-bin/mailman/<wbr>listinfo/subsurface</a><br>
</div></div></blockquote></div><br></div></div>