Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

could not redirect output of idevicesyslog well

#245

idevicesyslog goes well when I run it directly. But when I redirect its output, like "idevicesyslog > /tmp/log". It can only redirect the front part of output (say, 28672 byte) and cannot append the rest output any more.

So I cannot get the device's syslog automatically. I also wrote the code to run the command "idevicesyslog -u " and get the output, still only get the front part (32768 byte).

Why does it happen? Would you please help to fix it? Or we could not get the device's syslog automatically :(

Reported by viewrain · December 20th, 2011 @ 10:04 AM

State: resolved
Milestone: none
Assigned to: nobody

Activity

  1. viewrain
    viewrain

    I took a look at the source code. I found it was the problem of the buffering of stdout.
    In tools/idevicesyslog.c, I add one line "setvbuf(stdout, NULL, _IONBF, 0);" at the beginning of the main function to disable the buffering of stdout.
    Then the new binary could redirect the output normally when I run "idevicesyslog > /tmp/log".

    Would you please modify the code or is there a better solution?

    Thanks a lot~

    December 20th, 2011 @ 04:09 PM

  2. Nikias Bassen
    Nikias Bassen
    • State changed from new to resolved
    • Tag set to idevicesyslog

    I committed a fix using fflush to write out the buffer immediately after the fwrite call. This should fix the issue.

    January 11th, 2012 @ 11:02 PM

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.