how to disable buffering in pjsua log file in linux?

S
segalion
Sun, Jul 9, 2017 7:58 AM

I am trying pjsua 2.0 in linux (ubuntu 64 LTS) and I am experienced that
the writing of log file is highly buffered. I need to detect events in real
time from log, and due to this, I have delays for more than 10 seconds and
even uncompleted lines ...

making a "tail -f logfile" can show this easily

In windows the log events are written inmediatly so I can use realtime
events from log files-

Anybody can help me with this? Are there some config parameter in headers
(may be something like PJ_LOG_USE_STACK_BUFFER) to chage this behaviour in
linux?

Anybody know if pjsua 2.6 has better log realtime writting (I have some
patches in 2.0 and I dont want to rewrite again)

And one more... what about OSX?

Thanks again for this amazing software...

I am trying pjsua 2.0 in linux (ubuntu 64 LTS) and I am experienced that the writing of log file is highly buffered. I need to detect events in real time from log, and due to this, I have delays for more than 10 seconds and even uncompleted lines ... making a "tail -f logfile" can show this easily In windows the log events are written inmediatly so I can use realtime events from log files- Anybody can help me with this? Are there some config parameter in headers (may be something like PJ_LOG_USE_STACK_BUFFER) to chage this behaviour in linux? Anybody know if pjsua 2.6 has better log realtime writting (I have some patches in 2.0 and I dont want to rewrite again) And one more... what about OSX? Thanks again for this amazing software...
BG
Bill Gardner
Sun, Jul 9, 2017 2:22 PM

If I recall correctly, log file writing is done via stdio and there is
no way in pjsip to configure buffering. There is a commented out line
that flushes the logfile with an advisory not to enable because of the
performance hit. It's obviously not a good idea to flush on every log
entry. It would be pretty easy to run a periodic timer task that flushes
the logfile a few times a second, that may suffice for your needs.

Not sure why you see different behavior on Windows, in my experience the
pjsip log is buffered on all platforms.

Regards,

Bill

On 7/9/2017 3:58 AM, segalion wrote:

I am trying pjsua 2.0 in linux (ubuntu 64 LTS) and I am experienced
that the writing of log file is highly buffered. I need to detect
events in real time from log, and due to this, I have delays for more
than 10 seconds and even uncompleted lines ...

making a "tail -f logfile" can show this easily

In windows the log events are written inmediatly so I can use realtime
events from log files-

Anybody can help me with this? Are there some config parameter in
headers (may be something like PJ_LOG_USE_STACK_BUFFER) to chage this
behaviour in linux?

Anybody know if pjsua 2.6 has better log realtime writting (I have
some patches in 2.0 and I dont want to rewrite again)

And one more... what about OSX?

Thanks again for this amazing software...


Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@lists.pjsip.org
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org

If I recall correctly, log file writing is done via stdio and there is no way in pjsip to configure buffering. There is a commented out line that flushes the logfile with an advisory not to enable because of the performance hit. It's obviously not a good idea to flush on every log entry. It would be pretty easy to run a periodic timer task that flushes the logfile a few times a second, that may suffice for your needs. Not sure why you see different behavior on Windows, in my experience the pjsip log is buffered on all platforms. Regards, Bill On 7/9/2017 3:58 AM, segalion wrote: > I am trying pjsua 2.0 in linux (ubuntu 64 LTS) and I am experienced > that the writing of log file is highly buffered. I need to detect > events in real time from log, and due to this, I have delays for more > than 10 seconds and even uncompleted lines ... > > making a "tail -f logfile" can show this easily > > In windows the log events are written inmediatly so I can use realtime > events from log files- > > Anybody can help me with this? Are there some config parameter in > headers (may be something like PJ_LOG_USE_STACK_BUFFER) to chage this > behaviour in linux? > > Anybody know if pjsua 2.6 has better log realtime writting (I have > some patches in 2.0 and I dont want to rewrite again) > > And one more... what about OSX? > > > Thanks again for this amazing software... > > > > > > _______________________________________________ > Visit our blog: http://blog.pjsip.org > > pjsip mailing list > pjsip@lists.pjsip.org > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org