#[global]
global:
loglevel: DEBUG
- #logfile: /var/log/osm/lcm.log
+ logfile: /var/log/osm/lcm.log
+ # nologging: True # do no log to stdout/stderr
#[RO]
RO:
port: 9090
tenant: osm
loglevel: DEBUG
- #logfile: /var/log/osm/lcm-ro.log
+ # logfile: /var/log/osm/lcm-ro.log
#[VCA]
VCA:
user: admin
secret: secret
loglevel: DEBUG
- #logfile: /var/log/osm/lcm-vca.log
+ # logfile: /var/log/osm/lcm-vca.log
#[database]
database:
user: user
password: password
loglevel: DEBUG
- #logfile: /var/log/osm/lcm-database.log
+ # logfile: /var/log/osm/lcm-database.log
#[storage]
storage:
# for local provide file path
path: /app/storage
loglevel: DEBUG
- #logfile: /var/log/osm/lcm-storage.log
+ # logfile: /var/log/osm/lcm-storage.log
#[message]
message:
host: kafka
port: 9092
loglevel: DEBUG
- #logfile: /var/log/osm/lcm-message.log
+ # logfile: /var/log/osm/lcm-message.log
__author__ = "Alfonso Tierno"
min_RO_version = [0, 5, 72]
+# uncomment if LCM is installed as library and installed, and get them from __init__.py
+lcm_version = '0.1.12'
+lcm_version_date = '2018-08-23'
class LcmException(Exception):
config["database"]["logger_name"] = "lcm.db"
config["storage"]["logger_name"] = "lcm.fs"
config["message"]["logger_name"] = "lcm.msg"
- if "logfile" in config["global"]:
+ if config["global"].get("logfile"):
file_handler = logging.handlers.RotatingFileHandler(config["global"]["logfile"],
maxBytes=100e6, backupCount=9, delay=0)
file_handler.setFormatter(log_formatter_simple)
self.logger.addHandler(file_handler)
- else:
+ if not config["global"].get("nologging"):
str_handler = logging.StreamHandler()
str_handler.setFormatter(log_formatter_simple)
self.logger.addHandler(str_handler)
for k1, logname in {"message": "lcm.msg", "database": "lcm.db", "storage": "lcm.fs"}.items():
config[k1]["logger_name"] = logname
logger_module = logging.getLogger(logname)
- if "logfile" in config[k1]:
+ if config[k1].get("logfile"):
file_handler = logging.handlers.RotatingFileHandler(config[k1]["logfile"],
maxBytes=100e6, backupCount=9, delay=0)
file_handler.setFormatter(log_formatter_simple)
logger_module.addHandler(file_handler)
- if "loglevel" in config[k1]:
+ if config[k1].get("loglevel"):
logger_module.setLevel(config[k1]["loglevel"])
- # self.logger.critical("starting osm/lcm version {} {}".format(lcm_version, lcm_version_date))
+ self.logger.critical("starting osm/lcm version {} {}".format(lcm_version, lcm_version_date))
self.n2vc = N2VC(
log=self.logger,
server=config['VCA']['host'],