当前位置: 首页>>代码示例>>Python>>正文


Python Logging.error方法代码示例

本文整理汇总了Python中seiscomp3.Logging.error方法的典型用法代码示例。如果您正苦于以下问题:Python Logging.error方法的具体用法?Python Logging.error怎么用?Python Logging.error使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在seiscomp3.Logging的用法示例。


在下文中一共展示了Logging.error方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: run

# 需要导入模块: from seiscomp3 import Logging [as 别名]
# 或者: from seiscomp3.Logging import error [as 别名]
	def run(self):
		retn = False
		try:
			for user in self._authBlacklist:
				self._userdb.blacklistUser(user)

			site = self._site()

			if not site:
				return False

			# start listen for incoming request
			self.__tcpPort = reactor.listenTCP(self._port,
			                                   site,
	 		                                   self._connections,
			                                   self._listenAddress)

			# setup signal handler
			self.__sighup = False
			signal.signal(signal.SIGHUP, self._sighupHandler)
		        task.LoopingCall(self._reloadTask).start(60, False)

			# start processing
			Logging.info("start listening")
			log.addObserver(logSC3)

			reactor.run()
			retn = True
		except Exception, e:
			Logging.error(str(e))
开发者ID:marcelobianchi,项目名称:seiscomp3,代码行数:32,代码来源:fdsnws.py

示例2: onCancel

# 需要导入模块: from seiscomp3 import Logging [as 别名]
# 或者: from seiscomp3.Logging import error [as 别名]
def onCancel(failure, req):
	if failure:
		Logging.error("%s %s" % (failure.getErrorMessage(),
		              traceback.format_tb(failure.getTracebackObject())))
	else:
		Logging.error("request canceled")
	req.cancel()
开发者ID:Fran89,项目名称:seiscomp3,代码行数:9,代码来源:utils.py

示例3: logSC3

# 需要导入模块: from seiscomp3 import Logging [as 别名]
# 或者: from seiscomp3.Logging import error [as 别名]
def logSC3(entry):
	try:
		isError = entry['isError']
		msg = entry['message']
		if isError:
			for l in msg:
				Logging.error("[reactor] %s" % l)
		else:
			for l in msg:
				Logging.info("[reactor] %s" % l)
	except:
		pass
开发者ID:palminn,项目名称:seiscomp3,代码行数:14,代码来源:fdsnws.py

示例4: onFinish

# 需要导入模块: from seiscomp3 import Logging [as 别名]
# 或者: from seiscomp3.Logging import error [as 别名]
def onFinish(result, req):
	Logging.debug("finish value = %s" % str(result))
	if isinstance(result, Failure):
		err = result.value
		if isinstance(err, defer.CancelledError):
			Logging.error("request canceled")
			return
		Logging.error("%s %s" % (result.getErrorMessage(),
		              traceback.format_tb(result.getTracebackObject())))
	else:
		if result:
			Logging.debug("request successfully served")
		else:
			Logging.debug("request failed")

	reactor.callFromThread(req.finish)
开发者ID:Fran89,项目名称:seiscomp3,代码行数:18,代码来源:utils.py

示例5: __getDayRaw

# 需要导入模块: from seiscomp3 import Logging [as 别名]
# 或者: from seiscomp3.Logging import error [as 别名]
    def __getDayRaw(self, day, startt, endt, net, sta, loc, cha, bufferSize):
        # Take into account the case of empty location
        if loc == '--':
            loc = ''

        for dataFile in self.__getMSName(day, net, sta, loc, cha):
            if not os.path.exists(dataFile):
                continue

            try:
                with open(dataFile, 'rb') as msFile:
                    for buf in self.__getWaveform(startt, endt, msFile, bufferSize):
                        yield buf

            except mseedlite.MSeedError as e:
                Logging.error("%s: %s" % (dataFile, str(e)))
开发者ID:SeisComP3,项目名称:seiscomp3,代码行数:18,代码来源:fastsds.py

示例6: open_SC3Db

# 需要导入模块: from seiscomp3 import Logging [as 别名]
# 或者: from seiscomp3.Logging import error [as 别名]
 def open_SC3Db(self, dbUrl):
     m = re.match("(?P<dbDriverName>^.*):\/\/(?P<dbAddress>.+?:[email protected]+?\/.+$)", dbUrl)
     if not m:
         raise SystemExit, "error in parsing SC3 DB url"
     _dbUrl = m.groupdict()
     
     dbDriver = IO.DatabaseInterface.Create(_dbUrl["dbDriverName"])
     if dbDriver is None:
         Logging.error("Cannot find database driver " + _dbUrl["dbDriverName"])
         raise SystemExit, "driver not found"
     if not dbDriver.connect(_dbUrl["dbAddress"]):
         Logging.error("Cannot connect to database at " + _dbUrl["dbAddress"])
         raise SystemExit, "connection could not be established"
     print "opening destination Database: " + _dbUrl["dbAddress"]
     dbQuery = DataModel.DatabaseQuery(dbDriver)
     sc3wrap.dbQuery = dbQuery
     
     return dbQuery
开发者ID:preinh,项目名称:acessSC3,代码行数:20,代码来源:acess_stations.py

示例7: __init__

# 需要导入模块: from seiscomp3 import Logging [as 别名]
# 或者: from seiscomp3.Logging import error [as 别名]
    def __init__(self, config, name, group):
        mediatorAddress = config.getString("connection.server")
        dbDriverName = config.getString("database.type")
        dbAddress = config.getString("database.parameters")

        connection = Communication.Connection.Create(mediatorAddress, name, group)
        if connection is None:
            Logging.error("Cannot connect to Mediator")
            raise ConnectionError, "connection could not be established"
        else:
            Logging.info("Connection has been established")

        dbDriver = IO.DatabaseInterface.Create(dbDriverName)
        if dbDriver is None:
            Logging.error("Cannot find database driver " + dbDriverName)
            raise DatabaseError, "driver not found"
        
        if not dbDriver.connect(dbAddress):
            Logging.error("Cannot connect to database at " + dbAddress)
            raise DatabaseError, "connection could not be established"
        
        self.__connection = connection

        # This reference to dbDriver is essential, since dbQuery becomes
        # invalid when dbDriver is deleted
        self.__dbDriver = dbDriver
        self.dbQuery = DatabaseQuery(dbDriver)
开发者ID:salichon,项目名称:SC3_VM_seattle,代码行数:29,代码来源:helpers.py

示例8: _filterInventory

# 需要导入模块: from seiscomp3 import Logging [as 别名]
# 或者: from seiscomp3.Logging import error [as 别名]
	def _filterInventory(self, inv, fileName, serviceName=""):
		if not fileName:
			return True

		class FilterRule:
			def __init__(self, name, code):
				self.name       = name
				self.exclude    = name.startswith("!")
				self.code       = code

				self.restricted = None
				self.shared     = None
				self.netClass   = None
				self.archive    = None

		# read filter configuration from INI file
		filter = []
		includeRuleDefined = False
		try:
			import ConfigParser
		except ImportError, ie:
			Logging.error("could not load 'ConfigParser' Python module")
			return False
开发者ID:marcopovitch,项目名称:seiscomp3,代码行数:25,代码来源:fdsnws.py

示例9: init

# 需要导入模块: from seiscomp3 import Logging [as 别名]
# 或者: from seiscomp3.Logging import error [as 别名]
    def init(self):
        if not Client.Application.init(self):
            return False

        try:
            start = self.commandline().optionString("begin")
        except:
            start = "1900-01-01T00:00:00Z"
        self._startTime = _parseTime(start)
        if self._startTime is None:
            Logging.error("Wrong 'begin' format '%s'" % start)
            return False
        Logging.debug("Setting start to %s" % self._startTime.toString("%FT%TZ"))

        try:
            end = self.commandline().optionString("end")
        except:
            end = "2500-01-01T00:00:00Z"
        self._endTime = _parseTime(end)
        if self._endTime is None:
            Logging.error("Wrong 'end' format '%s'" % end)
            return False
        Logging.debug("Setting end to %s" % self._endTime.toString("%FT%TZ"))

        try:
            self._delimiter = self.commandline().optionString("delimiter")
        except:
            self._delimiter = "\n"

        try:
            modifiedAfter = self.commandline().optionString("modified-after")
            self._modifiedAfterTime = _parseTime(modifiedAfter)
            if self._modifiedAfterTime is None:
                Logging.error("Wrong 'modified-after' format '%s'" % modifiedAfter)
                return False
            Logging.debug("Setting 'modified-after' time to %s" % self._modifiedAfterTime.toString("%FT%TZ"))
        except: pass

        return True
开发者ID:Fran89,项目名称:seiscomp3,代码行数:41,代码来源:scevtls.py

示例10: run

# 需要导入模块: from seiscomp3 import Logging [as 别名]
# 或者: from seiscomp3.Logging import error [as 别名]
	def run(self):
		modeStr = None
		if self._evaluationMode is not None:
			modeStr = DataModel.EEvaluationModeNames.name(self._evaluationMode)
		whitelistStr = "<None>"
		if self._eventTypeWhitelist is not None:
			whitelistStr = ", ".join(self._eventTypeWhitelist)
		blacklistStr = "<None>"
		if self._eventTypeBlacklist is not None:
			blacklistStr = ", ".join(self._eventTypeBlacklist)
		Logging.notice("\n" \
		               "configuration read:\n" \
		               "  serve\n" \
		               "    dataselect    : %s\n" \
		               "    event         : %s\n" \
		               "    station       : %s\n" \
		               "  listenAddress   : %s\n" \
		               "  port            : %i\n" \
		               "  connections     : %i\n" \
		               "  htpasswd        : %s\n" \
		               "  accessLog       : %s\n" \
		               "  queryObjects    : %i\n" \
		               "  realtimeGap     : %s\n" \
		               "  samples (M)     : %s\n" \
		               "  allowRestricted : %s\n" \
		               "  hideAuthor      : %s\n" \
		               "  evaluationMode  : %s\n" \
		               "  eventType\n" \
		               "    whitelist     : %s\n" \
		               "    blacklist     : %s\n" % (
		               self._serveDataSelect, self._serveEvent,
		               self._serveStation, self._listenAddress, self._port,
		               self._connections, self._htpasswd, self._accessLogFile,
		               self._queryObjects, self._realtimeGap, self._samplesM,
		               self._allowRestricted, self._hideAuthor, modeStr,
		               whitelistStr, blacklistStr))

		if not self._serveDataSelect and not self._serveEvent and \
		   not self._serveStation:
			Logging.error("all services disabled through configuration")
			return False

		# access logger if requested
		if self._accessLogFile:
			self._accessLog = Log(self._accessLogFile)

		# load inventory needed by DataSelect and Station service
		if self._serveDataSelect or self._serveStation:
			self._loadInventory()

		DataModel.PublicObject.SetRegistrationEnabled(False)

		shareDir = os.path.join(Environment.Instance().shareDir(), 'fdsnws')

		# Overwrite/set mime type of *.wadl and *.xml documents. Instead of
		# using the official types defined in /etc/mime.types 'application/xml'
		# is used as enforced by the FDSNWS spec.
		static.File.contentTypes['.wadl'] = 'application/xml'
		static.File.contentTypes['.xml'] = 'application/xml'

		# create resource tree /fdsnws/...
		root = ListingResource()

		fileName = os.path.join(shareDir, 'favicon.ico')
		fileRes = static.File(fileName, 'image/x-icon')
		fileRes.childNotFound = NoResource()
		fileRes.isLeaf = True
		root.putChild('favicon.ico', fileRes)

		prefix = ListingResource()
		root.putChild('fdsnws', prefix)

		# right now service version is shared by all services
		serviceVersion = ServiceVersion()

		# dataselect
		if self._serveDataSelect:
			dataselect = ListingResource()
			prefix.putChild('dataselect', dataselect)
			dataselect1 = DirectoryResource(os.path.join(shareDir, 'dataselect.html'))
			dataselect.putChild('1', dataselect1)

			dataselect1.putChild('query', FDSNDataSelect())
			msg = 'authorization for restricted time series data required'
			authSession = self._getAuthSessionWrapper(FDSNDataSelectRealm(), msg)
			dataselect1.putChild('queryauth', authSession)
			dataselect1.putChild('version', serviceVersion)
			fileRes = static.File(os.path.join(shareDir, 'dataselect.wadl'))
			fileRes.childNotFound = NoResource()
			dataselect1.putChild('application.wadl', fileRes)

		# event
		if self._serveEvent:
			event = ListingResource()
			prefix.putChild('event', event)
			event1 = DirectoryResource(os.path.join(shareDir, 'event.html'))
			event.putChild('1', event1)

			event1.putChild('query', FDSNEvent(self._hideAuthor,
			                                   self._evaluationMode,
#.........这里部分代码省略.........
开发者ID:palminn,项目名称:seiscomp3,代码行数:103,代码来源:fdsnws.py

示例11: run

# 需要导入模块: from seiscomp3 import Logging [as 别名]
# 或者: from seiscomp3.Logging import error [as 别名]
	def run(self):
		modeStr = None
		if self._evaluationMode is not None:
			modeStr = DataModel.EEvaluationModeNames.name(self._evaluationMode)
		whitelistStr = "<None>"
		if self._eventTypeWhitelist is not None:
			whitelistStr = ", ".join(self._eventTypeWhitelist)
		blacklistStr = "<None>"
		if self._eventTypeBlacklist is not None:
			blacklistStr = ", ".join(self._eventTypeBlacklist)
		stationFilterStr = "<None>"
		if self._stationFilter is not None:
			stationFilterStr = self._stationFilter
		dataSelectFilterStr = "<None>"
		if self._dataSelectFilter is not None:
			dataSelectFilterStr = self._dataSelectFilter
		Logging.debug("\n" \
		               "configuration read:\n" \
		               "  serve\n" \
		               "    dataselect    : %s\n" \
		               "    event         : %s\n" \
		               "    station       : %s\n" \
		               "  listenAddress   : %s\n" \
		               "  port            : %i\n" \
		               "  connections     : %i\n" \
		               "  htpasswd        : %s\n" \
		               "  accessLog       : %s\n" \
		               "  queryObjects    : %i\n" \
		               "  realtimeGap     : %s\n" \
		               "  samples (M)     : %s\n" \
		               "  allowRestricted : %s\n" \
		               "  useArclinkAccess: %s\n" \
		               "  hideAuthor      : %s\n" \
		               "  evaluationMode  : %s\n" \
		               "  eventType\n" \
		               "    whitelist     : %s\n" \
		               "    blacklist     : %s\n" \
		               "  inventory filter\n" \
		               "    station       : %s\n" \
		               "    dataSelect    : %s\n" \
		               "    debug enabled : %s\n" \
		               "  trackdb\n" \
		               "    enabled       : %s\n" \
		               "    defaultUser   : %s\n" \
		               "  auth\n" \
		               "    enabled       : %s\n" \
		               "    gnupgHome     : %s\n" % (
		               self._serveDataSelect, self._serveEvent,
		               self._serveStation, self._listenAddress, self._port,
		               self._connections, self._htpasswd, self._accessLogFile,
		               self._queryObjects, self._realtimeGap, self._samplesM,
		               self._allowRestricted, self._useArclinkAccess,
		               self._hideAuthor, modeStr,
		               whitelistStr, blacklistStr, stationFilterStr,
		               dataSelectFilterStr, self._debugFilter,
		               self._trackdbEnabled, self._trackdbDefaultUser,
		               self._authEnabled, self._authGnupgHome))

		if not self._serveDataSelect and not self._serveEvent and \
		   not self._serveStation:
			Logging.error("all services disabled through configuration")
			return False

		# access logger if requested
		if self._accessLogFile:
			self._accessLog = Log(self._accessLogFile)

		# load inventory needed by DataSelect and Station service
		stationInv = dataSelectInv = None
		if self._serveDataSelect or self._serveStation:
			retn = False
			stationInv = dataSelectInv = Inventory.Instance().inventory()
			Logging.info("inventory loaded")

			if self._serveDataSelect and self._serveStation:
				# clone inventory if station and dataSelect filter are distinct
				# else share inventory between both services
				if self._stationFilter != self._dataSelectFilter:
					dataSelectInv = self._cloneInventory(stationInv)
					retn = self._filterInventory(stationInv, self._stationFilter, "station") and \
					       self._filterInventory(dataSelectInv, self._dataSelectFilter, "dataSelect")
				else:
					retn = self._filterInventory(stationInv, self._stationFilter)
			elif self._serveStation:
				retn = self._filterInventory(stationInv, self._stationFilter)
			else:
				retn = self._filterInventory(dataSelectInv, self._dataSelectFilter)

			if not retn:
				return False

		if self._serveDataSelect:
			self._access.initFromSC3Routing(self.query().loadRouting())

		DataModel.PublicObject.SetRegistrationEnabled(False)

		shareDir = os.path.join(Environment.Instance().shareDir(), 'fdsnws')

		# Overwrite/set mime type of *.wadl and *.xml documents. Instead of
		# using the official types defined in /etc/mime.types 'application/xml'
#.........这里部分代码省略.........
开发者ID:marcopovitch,项目名称:seiscomp3,代码行数:103,代码来源:fdsnws.py

示例12: len

# 需要导入模块: from seiscomp3 import Logging [as 别名]
# 或者: from seiscomp3.Logging import error [as 别名]
		try:
			cp = ConfigParser.ConfigParser()
			Logging.notice("reading inventory filter file: %s" % fileName)
			cp.readfp(open(fileName, 'r'))
			if len(cp.sections()) == 0:
				return True

			# check for mandatory code attribute
			for sectionName in cp.sections():
				code = ""
				try:
					code = cp.get(sectionName, "code")
				except:
					Logging.error("missing 'code' attribute in section %s of " \
					              "inventory filter file %s" % (
					              sectionName, fileName))
					return False

				rule = FilterRule(sectionName, str(code))

				try:
					rule.restricted = cp.getboolean(sectionName, 'restricted')
				except: pass

				try:
					rule.shared = cp.getboolean(sectionName, 'shared')
				except: pass

				try:
					rule.netClass = str(cp.get(sectionName, 'netClass'))
开发者ID:marcopovitch,项目名称:seiscomp3,代码行数:32,代码来源:fdsnws.py

示例13: onRequestError

# 需要导入模块: from seiscomp3 import Logging [as 别名]
# 或者: from seiscomp3.Logging import error [as 别名]
def onRequestError(failure, req):
	Logging.error("%s %s" % (failure.getErrorMessage(),
	              traceback.format_tb(failure.getTracebackObject())))

	reactor.callFromThread(req.processingFailed, failure)
	return failure
开发者ID:salichon,项目名称:SC3_VM_seattle,代码行数:8,代码来源:utils.py

示例14: onResponseFailure

# 需要导入模块: from seiscomp3 import Logging [as 别名]
# 或者: from seiscomp3.Logging import error [as 别名]
def onResponseFailure(err, call):
	Logging.error("response canceled")
	call.cancel()
开发者ID:Fran89,项目名称:seiscomp3,代码行数:5,代码来源:utils.py

示例15: __getWaveform

# 需要导入模块: from seiscomp3 import Logging [as 别名]
# 或者: from seiscomp3.Logging import error [as 别名]
    def __getWaveform(self, startt, endt, msFile, bufferSize):
        if startt >= endt:
            return

        rec = mseedlite.Record(msFile)
        reclen = rec.size
        recStart = 0
        timeStart = rec.begin_time

        if rec.begin_time >= endt:
            return

        msFile.seek(-reclen, 2)
        rec = mseedlite.Record(msFile)
        recEnd = msFile.tell() / reclen - 1
        timeEnd = rec.begin_time

        if rec.end_time <= startt:
            return

        if timeStart >= timeEnd:
            Logging.error("%s: overlap detected (start=%s, end=%s)" % (msFile.name, timeStart, timeEnd))
            return

        (lower, et1) = self.__time2recno(msFile, reclen, timeStart, recStart, timeEnd, recEnd, startt)
        (upper, et2) = self.__time2recno(msFile, reclen, startt, lower, timeEnd, recEnd, endt)

        if upper < lower:
            Logging.error("%s: overlap detected (lower=%d, upper=%d)" % (msFile.name, lower, upper))
            upper = lower

        msFile.seek(lower * reclen)
        remaining = (upper - lower + 1) * reclen
        check = True

        if bufferSize % reclen:
            bufferSize += reclen - bufferSize % reclen

        while remaining > 0:
            size = min(remaining, bufferSize)
            data = msFile.read(size)
            remaining -= size
            offset = 0

            if not data:
                return

            if check:
                while offset < len(data):
                    rec = mseedlite.Record(data[offset:offset+reclen])

                    if rec.begin_time >= endt:
                        return

                    if rec.end_time > startt:
                        break

                    offset += reclen

                check = False

            if offset < len(data):
                yield data[offset:] if offset else data

        while True:
            data = msFile.read(reclen)

            if not data:
                return

            rec = mseedlite.Record(data)

            if rec.begin_time >= endt:
                return

            yield data
开发者ID:SeisComP3,项目名称:seiscomp3,代码行数:78,代码来源:fastsds.py


注:本文中的seiscomp3.Logging.error方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。