diff --git a/vn.trader/vtEngine.py b/vn.trader/vtEngine.py index 21e057d9..c05ef5a2 100644 --- a/vn.trader/vtEngine.py +++ b/vn.trader/vtEngine.py @@ -14,6 +14,7 @@ from ctaAlgo.ctaEngine import CtaEngine from dataRecorder.drEngine import DrEngine from riskManager.rmEngine import RmEngine +import logging ######################################################################## class MainEngine(object): @@ -62,7 +63,8 @@ class MainEngine(object): self.gatewayDict['CTP_EBF'].setQryEnabled(True) except Exception, e: print e - + + """ try: from ltsGateway.ltsGateway import LtsGateway self.addGateway(LtsGateway, 'LTS') @@ -123,7 +125,7 @@ class MainEngine(object): self.gatewayDict['OANDA'].setQryEnabled(True) except Exception, e: print e - + """ # ---------------------------------------------------------------------- def addGateway(self, gateway, gatewayName=None): """创建接口""" @@ -207,8 +209,11 @@ class MainEngine(object): log.logContent = content event = Event(type_=EVENT_LOG) event.dict_['data'] = log - self.eventEngine.put(event) - + self.eventEngine.put(event) + + # 写入本地log日志 + logging.info(content) + # ---------------------------------------------------------------------- def dbConnect(self): """连接MongoDB数据库""" diff --git a/vn.trader/vtGateway.py b/vn.trader/vtGateway.py index 39d7b740..e11dd20c 100644 --- a/vn.trader/vtGateway.py +++ b/vn.trader/vtGateway.py @@ -92,7 +92,11 @@ class VtGateway(object): # 通用事件 event1 = Event(type_=EVENT_ERROR) event1.dict_['data'] = error - self.eventEngine.put(event1) + self.eventEngine.put(event1) + + logMsg = u'{0}:[{1}]:{2}'.format(error.gatewayName, error.errorID,error.errorMsg ) + # 写入本地log日志 + logging.info(logMsg) # ---------------------------------------------------------------------- def onLog(self, log): @@ -102,7 +106,7 @@ class VtGateway(object): event1.dict_['data'] = log self.eventEngine.put(event1) - # 写入本地log日志 + # 写入本地log日志 logging.info(log.logContent)