def setup_logger(logger_configuration_file, log_dir=None, process_name='', log_file=''):
    logger_ = logging.getLogger(ALIGNAK_LOGGER_NAME)
    for handler in logger_.handlers:
        if not process_name:
            break
        if getattr(handler, '_name', None) == 'daemons':
            for hdlr in logger_.handlers:
                if 'alignak_tests' in hdlr.formatter._fmt:
                    formatter = logging.Formatter(hdlr.formatter._fmt.replace("alignak_tests",
                                                                              process_name))
                    hdlr.setFormatter(formatter)
                if getattr(hdlr, 'filename', None) and 'alignak_tests' in hdlr.filename:
                    hdlr.filename = hdlr.filename._fmt.replace("alignak_tests", process_name)
            break
    else:
        if not logger_configuration_file or not os.path.exists(logger_configuration_file):
            print("The logger configuration file does not exist: %s" % logger_configuration_file)
            return
        with open(logger_configuration_file, 'rt') as _file:
            config = json.load(_file)
            truncate = False
            if not process_name and not log_dir:
                truncate = True
            if not process_name:
                process_name = 'alignak_tests'
            if not log_dir:
                log_dir = '/tmp'
            for formatter in config['formatters']:
                if 'format' not in config['formatters'][formatter]:
                    continue
                config['formatters'][formatter]['format'] = \
                    config['formatters'][formatter]['format'].replace("%(daemon)s", process_name)
            for hdlr in config['handlers']:
                if 'filename' not in config['handlers'][hdlr]:
                    continue
                if log_file and hdlr == 'daemons':
                    config['handlers'][hdlr]['filename'] = log_file
                else:
                    config['handlers'][hdlr]['filename'] = \
                        config['handlers'][hdlr]['filename'].replace("%(logdir)s", log_dir)
                config['handlers'][hdlr]['filename'] = \
                    config['handlers'][hdlr]['filename'].replace("%(daemon)s", process_name)
                if truncate and os.path.exists(config['handlers'][hdlr]['filename']):
                    with open(config['handlers'][hdlr]['filename'], "w") as file_log_file:
                        file_log_file.truncate()
        logger_dictConfig(config)