~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/canonical/codehosting/sshserver.py

  • Committer: Jonathan Lange
  • Date: 2008-09-22 23:54:36 UTC
  • mto: This revision was merged to the branch mainline in revision 7059.
  • Revision ID: jml@canonical.com-20080922235436-8x9jgjao9gjotrq3
Review comments.

Show diffs side-by-side

added added

removed removed

Lines of Context:
288
288
    reported as OOPSes.
289
289
    """
290
290
    log = logging.getLogger('codehosting')
291
 
 
292
 
    if config.codehosting.debug_logfile is not None:
293
 
        # Create the directory that contains the debug logfile.
294
 
        parent_dir = os.path.dirname(config.codehosting.debug_logfile)
295
 
        if not os.path.exists(parent_dir):
296
 
            os.makedirs(parent_dir)
297
 
        assert os.path.isdir(parent_dir), (
298
 
            "%r should be a directory" % parent_dir)
299
 
 
300
 
        # Messages logged to 'codehosting' are stored in the debug_logfile.
301
 
        handler = logging.FileHandler(config.codehosting.debug_logfile)
302
 
        handler.setFormatter(
303
 
            logging.Formatter(
304
 
                '%(asctime)s %(levelname)-8s %(name)s\t%(message)s'))
305
 
        handler.setLevel(logging.DEBUG)
306
 
        log.addHandler(handler)
307
 
        log.setLevel(logging.DEBUG)
308
 
    else:
309
 
        log.setLevel(logging.CRITICAL)
310
 
 
311
 
    # Don't log 'codehosting' messages to stderr.
312
 
    if getattr(trace, '_stderr_handler', None) is not None:
313
 
        trace._stderr_handler.addFilter(_NotFilter('codehosting'))
314
 
 
 
291
    log.setLevel(logging.CRITICAL)
315
292
    if configure_oops_reporting:
316
293
        set_up_oops_reporting('codehosting')
317
 
 
318
294
    return log