Hi,
I run the same script several times a day which generates a separate log for each run. Each day the log corresponding to the scripts run time gets appended to. This makes it awkward to track events through time as I have to open each log in turn and find the relevant section that follows from a time-stamp in the previous log.
I am trying to output logs for all runs on the same day to one daily file using this code
my_home = '/home/myUserName/'
my_log_date = datetime.date.today().strftime('%Y%m%d_%A_')
my_log_file = os.path.join(my_home, "%s%s" %(my_log_date, 'sms_scheduler.log'))
logging.basicConfig(filename=my_log_file, level=logging.DEBUG)
logger = logging.getLogger("web2py.app.myApp")
logger.setLevel(logging.DEBUG)
logger.info("log file is < %s >" % my_log_file)
All my logger.info() output appears in usual scheduler log files (great!) but not in my_log_file which isn't even created.
The output for the last line shows my filename as
< /home/myUserName/20170824_Thursday_sms_scheduler.log >
What do I need to do to get logging redirected to my log file?
Many thanks for any help!