send udev debug output to stdout instead of syslog
PATCH 1/1 send udev debug output to stdout instead of syslog
This patch let udev talk to stderr instead of flooding the syslog.
The string UDEVDBG is maybe not the best choice.
udev.c renamed from dev/shm/udev-007/udev.c +11 -1
@@ -116,7 +116,15 @@ static void get_dirs(void)strncpy (udev_config_permission_filename, udev_config_dir,sizeof (udev_config_permission_filename));strncat (udev_config_permission_filename, udev_permission,sizeof (udev_config_permission_filename)); } - +int dgb_to_stdout; +void init_dbg (void ) +{ +if (getenv ("UDEVDBG" )) { +fprintf (stderr,"log to stderr\n" ); + dgb_to_stdout=1 ; + } +return ; +}int main (int argc,char **argv,char **envp) {char *action;
@@ -127,6 +135,8 @@ int main(int argc, char **argv, char **e main_argv = argv; main_envp = envp; +init_dbg (); +dbg ("version %s" ,UDEV_VERSION );if (argc !=2 ) {
udev.h renamed from dev/shm/udev-007/udev.h +9 -0
@@ -28,9 +28,14 @@#ifdef DEBUG #include <syslog.h> +extern int dgb_to_stdout; #define dbg(format, arg...) \ do { \ + if(dgb_to_stdout) { \ + fprintf (stderr , "%s: " format "\n", __FUNCTION__ , ## arg); \ + } else { \ log_message (LOG_DEBUG , "%s: " format , __FUNCTION__ , ## arg); \ + } \ } while (0)#else #define dbg(format, arg...) do { } while (0)
@@ -40,7 +45,11 @@#ifdef DEBUG_PARSER #define dbg_parse(format, arg...) \ do { \ + if(dgb_to_stdout) { \ + fprintf (stderr , "%s: " format "\n", __FUNCTION__ , ## arg); \ + } else { \ log_message (LOG_DEBUG , "%s: " format , __FUNCTION__ , ## arg); \ + } \ } while (0)#else #define dbg_parse(format, arg...) do { } while (0)
Signature · 14 lines
USB is for mice, FireWire is for men! sUse lINUX ag, nÜRNBERG ------------------------------------------------------- This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/ _______________________________________________ Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net [email protected] https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 1 line · Olaf Hering
This patch let udev talk to stderr instead of flooding the syslog.
Why? If you use the klibc build, it sends it there anyway :)
Quoted 1 line
The string UDEVDBG is maybe not the best choice.
I agree. Also, if you were to do this, why not just modify the log_message() function, and not increase the size of the macro?
thanks,
greg k-h
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel