diff --git a/monkey/monkey_island.py b/monkey/monkey_island.py index ea8c96efd..8bc887d89 100644 --- a/monkey/monkey_island.py +++ b/monkey/monkey_island.py @@ -7,7 +7,7 @@ import json # noqa: E402 from monkey_island.cc.main import main # noqa: E402 from monkey_island.cc.consts import ( DEFAULT_SERVER_CONFIG_PATH, - DEFAULT_LOGGING_CONFIG_PATH, + DEFAULT_LOGGER_CONFIG_PATH, ) # noqa: E402 from monkey_island.cc.island_logger import json_setup_logging # noqa: E402 @@ -34,23 +34,23 @@ def parse_cli_args(): default=DEFAULT_SERVER_CONFIG_PATH, ) parser.add_argument( - "--logging-config", + "--logger-config", action="store", help="The path to the logging configuration file.", - default=DEFAULT_LOGGING_CONFIG_PATH, + default=DEFAULT_LOGGER_CONFIG_PATH, ) args = parser.parse_args() - return (args.setup_only, args.server_config, args.logging_config) + return (args.setup_only, args.server_config, args.logger_config) if "__main__" == __name__: - (is_setup_only, server_config, logging_config) = parse_cli_args() + (is_setup_only, server_config, logger_config) = parse_cli_args() # This is here in order to catch EVERYTHING, some functions are being called on # imports, so the log init needs to be first. try: - json_setup_logging(logging_config) + json_setup_logging(logger_config) except (json.JSONDecodeError) as ex: print(f"Error loading logging config: {ex}") exit(1) diff --git a/monkey/monkey_island/cc/server_utils/consts.py b/monkey/monkey_island/cc/server_utils/consts.py index 4c793b587..c12a42731 100644 --- a/monkey/monkey_island/cc/server_utils/consts.py +++ b/monkey/monkey_island/cc/server_utils/consts.py @@ -13,6 +13,6 @@ DEFAULT_DEVELOP_SERVER_CONFIG_PATH = os.path.join( MONKEY_ISLAND_ABS_PATH, "cc", "server_config.json.develop" ) -DEFAULT_LOGGING_CONFIG_PATH = os.path.join( +DEFAULT_LOGGER_CONFIG_PATH = os.path.join( MONKEY_ISLAND_ABS_PATH, "cc", "island_logger_default_config.json" ) diff --git a/monkey/monkey_island/cc/server_utils/island_logger.py b/monkey/monkey_island/cc/server_utils/island_logger.py index a512e0217..224e85364 100644 --- a/monkey/monkey_island/cc/server_utils/island_logger.py +++ b/monkey/monkey_island/cc/server_utils/island_logger.py @@ -3,13 +3,13 @@ import logging.config import os from typing import Dict -from monkey_island.cc.consts import DEFAULT_LOGGING_CONFIG_PATH +from monkey_island.cc.consts import DEFAULT_LOGGER_CONFIG_PATH __author__ = "Maor.Rayzin" def json_setup_logging( - default_path=DEFAULT_LOGGING_CONFIG_PATH, + default_path=DEFAULT_LOGGER_CONFIG_PATH, default_level=logging.INFO, env_key="LOG_CFG", ): diff --git a/monkey/monkey_island/cc/test_island_logger.py b/monkey/monkey_island/cc/test_island_logger.py index bd9de46f4..b5618a95c 100644 --- a/monkey/monkey_island/cc/test_island_logger.py +++ b/monkey/monkey_island/cc/test_island_logger.py @@ -4,7 +4,7 @@ import os from monkey_island.cc.consts import MONKEY_ISLAND_ABS_PATH from monkey_island.cc.island_logger import json_setup_logging -TEST_LOGGING_CONFIG_PATH = os.path.join(MONKEY_ISLAND_ABS_PATH, "cc", "testing", +TEST_LOGGER_CONFIG_PATH = os.path.join(MONKEY_ISLAND_ABS_PATH, "cc", "testing", "logger_config.json") @@ -18,7 +18,7 @@ def test_expanduser_filename(monkeypatch, tmpdir): set_home_env(monkeypatch, tmpdir) - json_setup_logging(TEST_LOGGING_CONFIG_PATH) + json_setup_logging(TEST_LOGGER_CONFIG_PATH) logger = logging.getLogger("TestLogger") logger.info(TEST_STRING)