Esempio n. 1
0
        # retention goal here is 1k to 10K events
        # tests showed about 500 bytes/event
        # using 10Ke * 500B/e = 5MB
        # other non-debug logging will take away from this but it should be
        # minimal unless there are issues such as network errors, throttling etc
        info_handler = make_rotating_handler('pdagentd.log', 1048576, 5,
                                             logging.INFO)
        # debug logging file
        # retention goal here is 1 to 2 weeks
        # tests which showed about 15M over ~8 days
        # using 5MB *4 = 20 MB
        debug_handler = make_rotating_handler('pdagentd-debug.log', 5242880, 4,
                                              logging.DEBUG)
        # put it all together
        root_logger = logging.getLogger()
        root_logger.setLevel(logging.DEBUG)
        root_logger.addHandler(info_handler)
        root_logger.addHandler(debug_handler)
    else:
        root_logger = logging.getLogger()


# ---- Daemonize and run agent
if not (len(sys.argv) > 1 and sys.argv[1] == '-f'):
    daemonize(pidfile, umask=_DEFAULT_UMASK)
else:
    os.umask(_DEFAULT_UMASK)
if config_file:
    logging.config.fileConfig(config_file)
run()
Esempio n. 2
0
        handler.setLevel(level)
        return handler

    # info logging file
    # retention goal here is 1k to 10K events
    # tests showed about 500 bytes/event
    # using 10Ke * 500B/e = 5MB
    # other non-debug logging will take away from this but it should be
    # minimal unless there are issues such as network errors, throttling etc
    info_handler = make_rotating_handler(
        'pdagentd.log', 1048576, 5, logging.INFO
        )
    # debug logging file
    # retention goal here is 1 to 2 weeks
    # tests which showed about 15M over ~8 days
    # using 5MB *4 = 20 MB
    debug_handler = make_rotating_handler(
        'pdagentd-debug.log', 5242880, 4, logging.DEBUG
        )
    # put it all together
    root_logger = logging.getLogger()
    root_logger.setLevel(logging.DEBUG)
    root_logger.addHandler(info_handler)
    root_logger.addHandler(debug_handler)


# ---- Daemonize and run agent

daemonize(pidfile, umask=_DEFAULT_UMASK)
run()