Example #1
0
 def __init__(self, root, script_name=""):
     self.log = _cplogging.LogManager(id(self), cherrypy.log.logger_root)
     self.root = root
     self.script_name = script_name
     self.wsgiapp = _cpwsgi.CPWSGIApp(self)
     
     self.namespaces = self.namespaces.copy()
     self.namespaces["log"] = lambda k, v: setattr(self.log, k, v)
     self.namespaces["wsgi"] = self.wsgiapp.namespace_handler
     
     self.config = {}
Example #2
0
 def __init__(self, root, script_name = '', config = None):
     self.log = _cplogging.LogManager(id(self), cherrypy.log.logger_root)
     self.root = root
     self.script_name = script_name
     self.wsgiapp = _cpwsgi.CPWSGIApp(self)
     self.namespaces = self.namespaces.copy()
     self.namespaces['log'] = lambda k, v: setattr(self.log, k, v)
     self.namespaces['wsgi'] = self.wsgiapp.namespace_handler
     self.config = self.__class__.config.copy()
     if config:
         self.merge(config)
Example #3
0
    # Make sure CherryPy doesn't shutdown if the user logs out of Windows
    try:
        #pylint: disable=F0401
        import win32con
        win32con.CTRL_LOGOFF_EVENT = object()
    except ImportError:
        pass

    # override Cherrypy's default session locking behaviour
    import lib.sessions


    # replace CherryPy's LogManager class with our subclassed one
    from cherrypy import _cplogging
    _cplogging.LogManager = SplunkedLogManager
    cherrypy.log = _cplogging.LogManager()
    def _cp_buslog(msg, level):
        logger.log(level, 'ENGINE: %s' % msg)

    cherrypy.engine.unsubscribe('log', cherrypy._buslog)
    cherrypy.engine.subscribe('log', _cp_buslog)

    # import our custom pid-file writing plugin
    from lib.custompidfile import ProcessID

    # define etc, site-packages and share/search/mrsparkle in a os agnostic way:
    SPLUNK_ETC_PATH = make_splunkhome_path(['etc'])
    SPLUNK_MRSPARKLE_PATH = make_splunkhome_path(['share', 'search', 'mrsparkle'])

    # define filepath for pid file
    PID_PATH = make_splunkhome_path(['var', 'run', 'splunk', 'splunkweb.pid'])