class_docstr: A singleton application with full configuration support.
class_docstr_tok: ["A","singleton","application","with","full","configuration","support","."]
docstr: Start logging for this application.
  
  The default is to log to stderr using a StreamHandler, if no default
  handler already exists.  The log level starts at logging.WARN, but this
  can be adjusted by setting the ``log_level`` attribute.
code: def _log_default(self):
      """Start logging for this application.
  
      The default is to log to stderr using a StreamHandler, if no default
      handler already exists.  The log level starts at logging.WARN, but this
      can be adjusted by setting the ``log_level`` attribute.
      """
      log = logging.getLogger(self.__class__.__name__)
      log.setLevel(self.log_level)
      log.propagate = False
      _log = log  # copied from Logger.hasHandlers() (new in Python 3.2)
      while _log:
          if _log.handlers:
              return log
          if not _log.propagate:
              break
          else:
              _log = _log.parent
      if sys.executable and sys.executable.endswith("pythonw.exe"):
          # this should really go to a file, but file-logging is only
          # hooked up in parallel applications
          _log_handler = logging.StreamHandler(open(os.devnull, "w"))
      else:
          _log_handler = logging.StreamHandler()
      _log_formatter = self._log_formatter_cls(
          fmt=self.log_format, datefmt=self.log_datefmt
      )
      _log_handler.setFormatter(_log_formatter)
      log.addHandler(_log_handler)
      return log
  
imports: from __future__ import print_function
  from copy import deepcopy
  import json
  import logging
  import os
  import re
  import sys
  from collections import defaultdict, OrderedDict
  from decorator import decorator
  from traitlets.config.configurable import Configurable, SingletonConfigurable
  from traitlets.config.loader import KVArgParseConfigLoader, PyFileConfigLoader, Config, ArgumentError, ConfigFileNotFound, JSONFileConfigLoader
  from traitlets.traitlets import Bool, Unicode, List, Enum, Dict, Instance, TraitError, observe, observe_compat, default
  from ipython_genutils.importstring import import_item
  from ipython_genutils.text import indent, wrap_paragraphs, dedent
  from ipython_genutils import py3compat
  import six
label_desc: Use image node_id 4 for calling the Application obj's underlying member method code with example usage: obj._log_default() and returns: log, log