#111 Loglevel not working as intended

Unstable (example)
closed-accepted
log (1)
5
2014-06-12
2014-01-20
Darkvater
No

Setting the logging level does not work as intended. No matter what log level you set in the config file, you still get all the logging events. The problem is in log.c where a && should be a ||. See diff against 1.1.1

* fix the loglevel logic                                                                                                         
--- minidlna-1.1.1-orig/log.c   2013-11-02 09:06:41.000000000 +0800                                                              
+++ minidlna-1.1.1/log.c    2014-01-20 22:56:24.000000000 +0800                                                                  
@@ -133,7 +133,7 @@                                                                                                              
 {                                                                                                                               
    va_list ap;                                                                                                                  

-   if (level && level>log_level[facility] && level>E_FATAL)                                                                     
+   if (level && level>log_level[facility] ||  level>E_FATAL)                                                                    
        return;                                                                                                                  

    if (!log_fp)  

Discussion

  • Darkvater

    Darkvater - 2014-03-06

    My apologies for the patch, that was totally wrong. Here is a proper patch:

    https://github.com/Darkvater/minidlna/compare/master...%23111-log_level.diff

    I've written tests for it as well, don't really know where to put them. It allows a lot more flexibility:
    'log_level=debug' => set the level for all categories in one go
    'log_level=ssdp=debug' => set level for single category leaving everything else at default
    'log_level=debug,ssdp=error' => set default, override for single category
    and all the original options

     
  • Justin Maggard

    Justin Maggard - 2014-03-10

    Looks good, thanks! Added to git master.

     
  • Justin Maggard

    Justin Maggard - 2014-03-10
    • status: open --> closed-accepted
    • assigned_to: Justin Maggard
     

Log in to post a comment.