修正写日志的bug

This commit is contained in:
msincenselee 2018-01-15 19:54:59 +08:00
parent dae5201029
commit f1850175cc

View File

@ -4,7 +4,7 @@ print 'load vtEngine.py'
import shelve import shelve
from collections import OrderedDict from collections import OrderedDict
import os
from pymongo import MongoClient from pymongo import MongoClient
from pymongo.errors import ConnectionFailure from pymongo.errors import ConnectionFailure
@ -17,7 +17,7 @@ from vnpy.trader.language import text
from vnpy.trader.vtFunction import loadMongoSetting from vnpy.trader.vtFunction import loadMongoSetting
from vnpy.trader.vtGateway import * from vnpy.trader.vtGateway import *
from vnpy.trader.app import (ctaStrategy, riskManager) from vnpy.trader.app import (ctaStrategy, riskManager)
from vnpy.trader.setup_logger import get_logger from vnpy.trader.setup_logger import get_logger,setup_logger
import psutil import psutil
try: try:
@ -286,7 +286,9 @@ class MainEngine(object):
if self.logger is not None: if self.logger is not None:
self.logger.info(content) self.logger.info(content)
else: else:
self.logger = get_logger() filename = os.path.abspath(os.path.join(os.path.dirname(__file__), 'logs', 'vnpy'))
self.logger = setup_logger( filename=filename, name='vnpy')
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
def writeError(self, content): def writeError(self, content):