[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Custom logging in libssh


On 17.01.19 18:57, g4-lisz@xxxxxxxxxxxx wrote:

> On 17.01.19 17:29, Andreas Schneider wrote:
>> On Thursday, January 17, 2019 5:02:24 PM CET g4-lisz@xxxxxxxxxxxx wrote:
>>> On 17.01.19 16:40, g4-lisz@xxxxxxxxxxxx wrote:
>>>> I try to accomplish two things:
>>>>
>>>> 1) My libssh client should run as a deamon. So logging should go to a file
>>>> 2) I also want to use logging from my own code
>>>>
>>>> [...]
>>>>
>>>> Now it seems that logging is configured session-wise. So writing to the
>>>> logfile must be synchronized in some way when I use several sessions in
>>>> pthreads - right?
>>> I just found  ssh_set_log_callback() , so gladly I was wrong and it's
>>> not session-wise. But I think it still needs some sychnromization to
>>> write to a file from several sessions?

I changed my code to use the libssh logging routines. But something is
not really convenient: Logging does not work before the verbosity level
has been set. But it's set on session level, so one has to create a
session first.

But in a multi threaded application there's not always a SSH session in
the main / parent thread. So nothing can be logged until the first
session has been created... I now create a dummy session in the main
thread (only ssh_new() and ssh_options_set() to set
SSH_OPTIONS_LOG_VERBOSITY), but that's a bit uncomely.

Any idea what this could be solved in a more elegant way?

Thanks,
Till


References:
Custom logging in libsshg4-lisz@xxxxxxxxxxxx
Re: Custom logging in libsshg4-lisz@xxxxxxxxxxxx
Re: Custom logging in libsshAndreas Schneider <asn@xxxxxxxxxxxxxx>
Re: Custom logging in libsshg4-lisz@xxxxxxxxxxxx
Archive administrator: postmaster@lists.cynapses.org