Enabling netfid debug output

I'm trying to "watch" now netifd is, by default, handing some situations and want to enable its built-in debugging. Given that the build tree for netifd sets CMAKE_OPTIONS += -DDEBUG=1 I would expect that the debugging options are compiled in. Then given

Usage: netifd [options]
Options:
 -d <mask>:             Mask for debug messages
 -s <path>:             Path to the ubus socket
 -p <path>:             Path to netifd addons (default: /lib/netifd)
 -c <path>:             Path to UCI configuration
 -h <path>:             Path to the hotplug script
 -r <path>:             Path to resolv.conf
 -l <level>:            Log output level (default: 2)
 -S:                    Use stderr instead of syslog for log messages
                        (default: /sbin/hotplug-call)

and a read of netfid.h, I would have expected that a change to /etc/init.d/network to include

        procd_set_param command /sbin/netifd -d 15 -l 7

would have been logging debug-level messages for the four categories called out in the enums of netifd.h
Trying -l4, consistent with the seemingly non-standard definition of L_DEBUG in netifd.h doesn't resolve it either.

Is there something else I am missing?

Hi,

I am also working in netifd. I am not able print the logs in the console. any suggestions?
I tring printf, DPRINT, fprintf with stderr & stdout.

my logs comes only when i execute netifd again from the prompt.

Regards,
Arjun.

I ended up adding set -x to the scripts executed by netifd and the results appeared with the rest of my logs.

(and then set +x or the like to "turn it off" later)

1 Like

Iirc the netifd debug output ends up on stderr so you'll need to add an procd_set_param stderr 1 in /etc/init.d/network to relay those messages to the syslog.

2 Likes

Hi,
I met same thing, only first time the log print works.
when exec "network restart", there are no any log in 'logread".
Will be appreciated if any help.

Regards,
Gary