hostapd: logging to syslog (and in general)

Rafał Miłecki zajec5 at
Wed Mar 2 04:14:01 PST 2016


As you may know, there are few logging functions used in hostapd
project. The hostapd itself uses mainly following two:
1) hostapd_logger
2) wpa_printf

I'm running hostapd in the background (-B) so logging to syslog is
preferred way for me. Unfortunately there comes a problem. I can use
logger_syslog option but if affects messages printed with
hostapd_logger only. None of wpa_printf messages goes into the syslog
which means I'm missing a lot of important stuff including even

I'm looking for a way to fix/change this but it seems it won't be

First of all, _wpa_printf is capable of logging to syslog, however:
1) It needs enabling with wpa_debug_open_syslog which hostapd never does
2) Logging to syslog equals not printing to stdout (it's kind of XOR)

We can't simply add a call to the wpa_debug_open_syslog in hostapd
(e.g. in hostapd_global_init). This would redirect all wpa_printf
output to the syslog and hostapd_logger_cb uses wpa_printf for stdout

I was thinking about a way of fixing this but then I noticed how many
dependencies, different functions, config options, etc. do we have in
hostapd all around.

I'm wondering if there is any plan to handle messages printing a bit
easier? Or do you have any advises where to start? It seems to need
some refactoring and opinion of someone with better overview would be

It seems it grew a bit overcomplicated with all these wpa_printf,
wpa_msg, wpa_dbg, MSG_(DEBUG|INFO|WARNING|ERROR),
hostapd_logger_cb, callbacks, etc.


More information about the Hostap mailing list