Some more logging stuff.
This commit is contained in:
parent
5d99640480
commit
ddc20342d6
2 changed files with 10 additions and 7 deletions
|
|
@ -37,7 +37,7 @@ logger = logging.getLogger('linspector')
|
||||||
|
|
||||||
# i currently only increase the 3rd number because the goal is that 0.20.* will become the first
|
# i currently only increase the 3rd number because the goal is that 0.20.* will become the first
|
||||||
# stable version.
|
# stable version.
|
||||||
__version__ = '0.19.34.dev1'
|
__version__ = '0.19.35.dev1'
|
||||||
__author__ = 'Johannes Findeisen <you@hanez.org>'
|
__author__ = 'Johannes Findeisen <you@hanez.org>'
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -99,7 +99,7 @@ def main():
|
||||||
configuration = Configuration(args.configuration_path, environment, log)
|
configuration = Configuration(args.configuration_path, environment, log)
|
||||||
logger.debug('configuration dump: ' + configuration.dump_to_ini())
|
logger.debug('configuration dump: ' + configuration.dump_to_ini())
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
logger.critical('[linspector] configuration error: {0}'.format(err))
|
log('critical', '[linspector] configuration error: {0}'.format(err))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
if configuration.get_option('linspector', 'log_file'):
|
if configuration.get_option('linspector', 'log_file'):
|
||||||
|
|
@ -153,13 +153,13 @@ def main():
|
||||||
try:
|
try:
|
||||||
monitors = Monitors(configuration, environment, log, notifications, services, tasks)
|
monitors = Monitors(configuration, environment, log, notifications, services, tasks)
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
logger.warning('[linspector] monitor initialization error: {0}'.format(err))
|
log('warning', '[linspector] monitor initialization error: {0}'.format(err))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
linspector = Linspector(configuration, environment, log, monitors, plugins, scheduler)
|
linspector = Linspector(configuration, environment, log, monitors, plugins, scheduler)
|
||||||
#linspector.print_debug()
|
#linspector.print_debug()
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
logger.critical('[linspector] core initialization error: {0}'.format(err))
|
log('critical', '[linspector] core initialization error: {0}'.format(err))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
# daemon initialization
|
# daemon initialization
|
||||||
|
|
@ -169,20 +169,23 @@ def main():
|
||||||
linspectord = Linspectord(configuration, environment, linspector)
|
linspectord = Linspectord(configuration, environment, linspector)
|
||||||
# do handling of restart, start and stop commands but for now "start" is enough... ;)
|
# do handling of restart, start and stop commands but for now "start" is enough... ;)
|
||||||
if args.kill:
|
if args.kill:
|
||||||
|
log('info', '[linspector] stopping daemon.')
|
||||||
linspectord.stop()
|
linspectord.stop()
|
||||||
elif args.restart:
|
elif args.restart:
|
||||||
|
log('info', '[linspector] restarting daemon.')
|
||||||
linspectord.restart()
|
linspectord.restart()
|
||||||
else:
|
else:
|
||||||
|
log('info', '[linspector] starting daemon.')
|
||||||
linspectord.start()
|
linspectord.start()
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
logger.critical('[linspector] daemon error: {0}'.format(err))
|
log('critical', '[linspector] daemon error: {0}'.format(err))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
while True:
|
while True:
|
||||||
pass
|
pass
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
logger.info('[linspector] program terminated by user!')
|
log('info', '[linspector] program terminated by user!')
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ log_level= debug
|
||||||
log_file = ~/code/linspector/linspector/log/linspector.log
|
log_file = ~/code/linspector/linspector/log/linspector.log
|
||||||
; number of log files to be kept. i recommend to use the lowest sensible value for keeping performance high. so set
|
; number of log files to be kept. i recommend to use the lowest sensible value for keeping performance high. so set
|
||||||
; the size of the log file higher to increase the log history.
|
; the size of the log file higher to increase the log history.
|
||||||
log_file_count = 25
|
log_file_count = 5
|
||||||
; log file size in megabytes as float.
|
; log file size in megabytes as float.
|
||||||
;log_file_size = 1
|
;log_file_size = 1
|
||||||
; log file size in bytes as int. you can set to bytes if you want to set a value lower then 1 megabyte. but it will
|
; log file size in bytes as int. you can set to bytes if you want to set a value lower then 1 megabyte. but it will
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue