I've added logs to cover these situations and modules:
Configuration reset Configuration Insert Configuration Update Report steps Monkey downloads Env startup logs Also I've changed the logging init position so it covers every functions from main, some functions and vars are being called and init from import level, in order to log those situations I had to init the log system right on the beginning of the module.
This commit is contained in:
parent
ad0d9f4567
commit
f37fabaf75
|
@ -22,7 +22,7 @@ def load_env_from_file():
|
|||
try:
|
||||
__env_type = load_env_from_file()
|
||||
env = ENV_DICT[__env_type]()
|
||||
logger.info('Monkey\'s env is: {0}'.format(env))
|
||||
logger.info('Monkey\'s env is: {0}'.format(env.__class__.__name__))
|
||||
except Exception:
|
||||
logger.error('Failed initializing environment', exc_info=True)
|
||||
raise
|
||||
|
|
|
@ -9,11 +9,15 @@ BASE_PATH = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|||
if BASE_PATH not in sys.path:
|
||||
sys.path.insert(0, BASE_PATH)
|
||||
|
||||
from cc.island_logger import json_setup_logging
|
||||
# This is here in order to catch EVERYTHING, some functions are being called on imports the log init needs to be on top.
|
||||
json_setup_logging(default_path='island_logger_default_config.json', default_level=logging.DEBUG)
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
from cc.app import init_app
|
||||
from cc.utils import local_ip_addresses
|
||||
from cc.environment.environment import env
|
||||
from cc.database import is_db_server_up
|
||||
from cc.island_logger import json_setup_logging
|
||||
|
||||
|
||||
def main():
|
||||
|
@ -21,9 +25,6 @@ def main():
|
|||
from tornado.httpserver import HTTPServer
|
||||
from tornado.ioloop import IOLoop
|
||||
|
||||
json_setup_logging(default_path='island_logger_default_config.json', default_level=logging.DEBUG)
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
mongo_url = os.environ.get('MONGO_URL', env.get_mongo_url())
|
||||
|
||||
while not is_db_server_up(mongo_url):
|
||||
|
|
|
@ -20,7 +20,7 @@ class ClientRun(flask_restful.Resource):
|
|||
if monkey is not None:
|
||||
is_monkey_running = not monkey["dead"]
|
||||
else:
|
||||
logger.info("")
|
||||
logger.info("Monkey is not running")
|
||||
is_monkey_running = False
|
||||
|
||||
return jsonify(is_running=is_monkey_running)
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import flask_restful
|
||||
import logging
|
||||
|
||||
import flask_restful
|
||||
|
||||
from cc.auth import jwt_required
|
||||
from cc.services.island_logs import IslandLogService
|
||||
|
||||
|
@ -16,4 +17,3 @@ class IslandLog(flask_restful.Resource):
|
|||
return IslandLogService.get_log_file()
|
||||
except Exception as e:
|
||||
logger.error('Monkey Island logs failed to download', exc_info=True)
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@ class MonkeyConfiguration(flask_restful.Resource):
|
|||
config_json = json.loads(request.data)
|
||||
if 'reset' in config_json:
|
||||
ConfigService.reset_config()
|
||||
|
||||
else:
|
||||
ConfigService.update_config(config_json, should_encrypt=True)
|
||||
return self.get()
|
||||
|
|
Loading…
Reference in New Issue