#816: File logging is broken
---------------------------------------------+------------------------------
 Reporter:  Matthew Good <[EMAIL PROTECTED]>  |       Owner:  anonymous
     Type:  defect                           |      Status:  new      
 Priority:  normal                           |   Milestone:           
Component:  TurboGears                       |     Version:  0.9a5    
 Severity:  normal                           |    Keywords:           
---------------------------------------------+------------------------------
 Changeset r1263 broke the file logging since it tries to open a
 `StreamHandler` with the filename instead of a file-like object.  The
 following patch should fix it:

 {{{
 #!diff
 Index: turbogears/startup.py
 ===================================================================
 --- turbogears/startup.py       (revision 1349)
 +++ turbogears/startup.py       (working copy)
 @@ -197,14 +197,15 @@
              handler.setFormatter(fmt)
              setuplog.addHandler(handler)

 -        logfile = turbogears.config.get("server.log_file", sys.stdout)
 -        setuplog = logging.getLogger("turbogears.access")
 -        setuplog.propagate = 0
 -        fmt = logging.Formatter("%(message)s")
 -        handler = logging.StreamHandler(logfile)
 -        handler.setLevel(logging.INFO)
 -        handler.setFormatter(fmt)
 -        setuplog.addHandler(handler)
 +        logfile = turbogears.config.get("server.log_file")
 +        if logfile:
 +            setuplog = logging.getLogger("turbogears.access")
 +            setuplog.propagate = 0
 +            fmt = logging.Formatter("%(message)s")
 +            handler = logging.FileHandler(logfile)
 +            handler.setLevel(logging.INFO)
 +            handler.setFormatter(fmt)
 +            setuplog.addHandler(handler)

      bonjoursetting = turbogears.config.get("tg.bonjour", None)
      if bonjoursetting or isdev:
 }}}

-- 
Ticket URL: <http://trac.turbogears.org/turbogears/ticket/816>
TurboGears <http://www.turbogears.org/>
TurboGears front-to-back web development
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears Tickets" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears-tickets
-~----------~----~----~----~------~----~------~--~---

Reply via email to