import logging
import logging.handlers


# ######### Set up logging ##########
# log.basicConfig(format="%(asctime)s - %(levelname)s: %(message)s", level=log.DEBUG)
logger = logging.getLogger('bb_log')
logger.setLevel(logging.DEBUG)

# create file handler which logs even debug messages
tfh = logging.handlers.TimedRotatingFileHandler('./logs/app.log', when='midnight', delay=False, encoding=None,
                                                backupCount=7)
tfh.setLevel(logging.DEBUG)

# create console handler with a higher log level
ch = logging.StreamHandler()
ch.setLevel(logging.DEBUG)

# create formatter and add it to the handlers
formatterch = logging.Formatter('%(asctime)s [%(levelname)s] %(message)s')
formattertfh = logging.Formatter('%(asctime)s [%(levelname)s] [%(name)s] %(message)s')
ch.setFormatter(formatterch)
tfh.setFormatter(formattertfh)

# add the handlers to logger
logger.addHandler(ch)
logger.addHandler(tfh)
import logging
import logging.handlers


# ######### Set up logging ##########
# log.basicConfig(format="%(asctime)s - %(levelname)s: %(message)s", level=log.DEBUG)
logger = logging.getLogger('bb_log')
logger.setLevel(logging.DEBUG)

# create file handler which logs even debug messages
tfh = logging.handlers.TimedRotatingFileHandler('./logs/app.log', when='midnight', delay=False, encoding=None,
                                                backupCount=5)
tfh.setLevel(logging.DEBUG)

# create console handler with a higher log level
ch = logging.StreamHandler()
ch.setLevel(logging.DEBUG)

# create formatter and add it to the handlers
formatterch = logging.Formatter('%(asctime)s %(levelname)s: %(message)s')
formattertfh = logging.Formatter('%(asctime)s %(levelname)s: %(message)s - %(name)s')
ch.setFormatter(formatterch)
tfh.setFormatter(formattertfh)

# add the handlers to logger
logger.addHandler(ch)
logger.addHandler(tfh)
--- 
+++ 
@@ -9,7 +9,7 @@
 
 # create file handler which logs even debug messages
 tfh = logging.handlers.TimedRotatingFileHandler('./logs/app.log', when='midnight', delay=False, encoding=None,
-                                                backupCount=5)
+                                                backupCount=7)
 tfh.setLevel(logging.DEBUG)
 
 # create console handler with a higher log level
@@ -17,8 +17,8 @@
 ch.setLevel(logging.DEBUG)
 
 # create formatter and add it to the handlers
-formatterch = logging.Formatter('%(asctime)s %(levelname)s: %(message)s')
-formattertfh = logging.Formatter('%(asctime)s %(levelname)s: %(message)s - %(name)s')
+formatterch = logging.Formatter('%(asctime)s [%(levelname)s] %(message)s')
+formattertfh = logging.Formatter('%(asctime)s [%(levelname)s] [%(name)s] %(message)s')
 ch.setFormatter(formatterch)
 tfh.setFormatter(formattertfh)
 
Update log output so that it works more nicely with ELK
