-
-
Save lacoski/0d54fdd55ac629a7f151c6d9af224fee to your computer and use it in GitHub Desktop.
oslo.config + oslo.log sample
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from oslo.config import cfg | |
from oslo_log import log as oslo_logging | |
CONF = cfg.CONF | |
CONF.register_opt(cfg.StrOpt('NODE_NAME'), cfg.OptGroup('HA')) | |
def main(): | |
oslo_logging.register_options(CONF) | |
CONF(sys.argv[1:], default_config_files=['app.conf']) | |
oslo_logging.setup(CONF, 'xyz') | |
LOG = oslo_logging.getLogger('') | |
try: | |
raise Exception('hello') | |
except: | |
LOG.error('got exception') | |
if __name__ == '__main__': | |
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/etc/my.conf | |
[DEFAULT] | |
########### | |
# Logging # | |
########### | |
# syslog server configuration (default port(UDP): 514) | |
# NOTE: Following logging configuration can be left as is for logs to come on UI | |
syslog_host=127.0.0.1 | |
syslog_port=514 | |
# log facility | |
log_facility=LOG_LOCAL3 | |
[HA] | |
NODE_NAME=NODE1 | |
DIR_STR=/opt | |
[OPENSTACK] | |
HA_VIRTUAL_IP=192.168.0.26 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment