Bug 1222236
| Summary: | logging file is not created when using from ovirt.node.utils.fs import Config | ||
|---|---|---|---|
| Product: | [Retired] oVirt | Reporter: | Douglas Schilling Landgraf <dougsland> |
| Component: | ovirt-node | Assignee: | Douglas Schilling Landgraf <dougsland> |
| Status: | CLOSED NOTABUG | QA Contact: | bugs <bugs> |
| Severity: | high | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 3.6 | CC: | ecohen, gklein, lsurette, mgoldboi, ovirt-bugs, rbalakri, yeylon |
| Target Milestone: | --- | ||
| Target Release: | --- | ||
| Hardware: | All | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | Bug Fix | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2015-05-16 21:46:06 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
|
Description
Douglas Schilling Landgraf
2015-05-16 19:21:05 UTC
I was not setting the logging handlers, so when loading the ovirt node modules which set it, the program was inheriting it too. For reference only, the below code, handle the logging as expected.
def __set_logger(self):
"""
The logging settings
Saving log in: /var/log/vdsm/register.log
"""
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
logger.propagate = False
fh = logging.FileHandler("/var/log/vdsm/register.log")
fh.setLevel(logging.DEBUG)
ch = logging.StreamHandler(stream=sys.stdout)
ch.setLevel(logging.ERROR)
de_fmt = logging.Formatter("%(asctime)s %(message)s",
"%m/%d/%Y %I:%M:%S %p")
ih = logging.StreamHandler(stream=sys.stdout)
ih.setLevel(logging.INFO)
i_fmt = logging.Formatter("%(message)s",
"%m/%d/%Y %I:%M:%S %p")
fh.setFormatter(de_fmt)
ch.setFormatter(de_fmt)
ih.setFormatter(i_fmt)
logger.addHandler(fh)
logger.addHandler(ch)
logger.addHandler(ih)
logging.captureWarnings(True)
return logger
|