You need to change the Logfile path by using logging.handlers python module . In my case I did the following stuff :
import logging
from logging.handlers import RotatingFileHandler
import blackboard
WEBAPP_CONSTANTS = {
'LOGFILE': '/home/ai/Desktop/home/ubuntu/LCF/GA-LCF/ga.log',
}
def getWebAppConstants(constant):
return WEBAPP_CONSTANTS.get(constant, False)
LOGFILE = getWebAppConstants('LOGFILE')
log_handler = RotatingFileHandler(LOGFILE, maxBytes=1048576, backupCount=5)
log_handler.setFormatter(logging.Formatter( '%(asctime)s %(levelname)s: %(message)s ' '[in %(pathname)s:%(lineno)d]'))
applogger = logging.getLogger("GA")
applogger.setLevel(logging.DEBUG)
applogger.addHandler(log_handler)
applogger.debug("Starting of Genetic Algorithm")
from pyevolve import *
def eval_func(chromosome):
some function here
and it worked. However I still don't know the reason why it was earlier trying to make genetic.log at root directory .