def METHOD_NAME(self):
    """Setting Logging to both console and a file if logfile is specified"""
    logging.getLogger("urllib3").setLevel(logging.ERROR)
    logging.getLogger("requests").setLevel(logging.ERROR)
    logging.getLogger('apscheduler.scheduler').setLevel(logging.ERROR)
    logging.getLogger('apscheduler.executors.default').setLevel(logging.ERROR)
    logger = logging.getLogger()
    for handler in logger.handlers:
        if handler.__class__.__name__ == "StreamHandler":
            logger.removeHandler(handler)
    stream_handler = logging.StreamHandler(stream=sys.stdout)
    stream_handler.setLevel(logging.INFO)
    logger.addHandler(stream_handler)
    if self.debug:
        logger.setLevel(logging.DEBUG)
    elif self.is_backtest:
        logger.setLevel(logging.INFO)
        for handler in logger.handlers:
            if handler.__class__.__name__ == "StreamHandler":
                handler.setLevel(logging.ERROR)
    else:
        logger.setLevel(logging.INFO)
    # Setting file logging
    if self.logfile:
        dir = os.path.dirname(os.path.abspath(self.logfile))
        if not os.path.exists(dir):
            os.mkdir(dir)
        fileHandler = logging.FileHandler(self.logfile, mode="w")
        logger.addHandler(fileHandler)
    for handler in logger.handlers:
        handler.setFormatter(self.log_format)
    logger.propagate = True
    # Disable Interactive Brokers logs
    for log_name, log_obj in logging.Logger.manager.loggerDict.items():
        if log_name.startswith("ibapi"):
            iblogger = logging.getLogger(log_name)
            iblogger.setLevel(logging.CRITICAL)
            iblogger.disabled = True