Discussion:
How to log from mock.cfg?
Vit Ry
2017-09-11 14:13:45 UTC
Permalink
Hi all!

What is the easiest way to log some data from my mock.cfg / site-defaults.cfg ?
I dynamically load repo-priority file and generates repos-data. So I want to print some
debug as INFO message. How can I connect to mock's logger, so I wouldn't see my debug with
mock -q -r ...
and would see it otherwise (without -q) ?

I take a look into sources and find there is logging.warning level before reading config files..=\
Any ideas?

---
Regards,
Vit Ry.


_______________________________________________
buildsys mailing list -- ***@lists.fedoraproject.org
To unsubscribe send an email to buildsys-lea
Miroslav Suchý
2017-09-11 14:55:33 UTC
Permalink
Post by Vit Ry
Hi all!
What is the easiest way to log some data from my mock.cfg / site-defaults.cfg ?
I dynamically load repo-priority file and generates repos-data. So I want to print some
debug as INFO message. How can I connect to mock's logger, so I wouldn't see my debug with
mock -q -r ...
and would see it otherwise (without -q) ?
I take a look into sources and find there is logging.warning level before reading config files..=\
Any ideas?
There is in site-defaults.cfg:

# You can configure log format to pull from logging.ini formats of these names:
# config_opts['build_log_fmt_name'] = "unadorned"

# config_opts['root_log_fmt_name'] = "detailed"
# config_opts['state_log_fmt_name'] = "state"

and there is /etc/mock/logging.ini

So it should work somehow, but I never done it.

The other option can be:
https://github.com/rpm-software-management/mock/issues/105
I have one highschool intern who is working on that. Despite the fact that is quite slow,
it should be done this week.

Mirek
_______________________________________________
buildsys mailing list -- ***@lists.fedoraproject.org
To unsubscribe send an email to buildsys-***@lists.fedoraprojec
Vit Ry
2017-09-12 09:28:12 UTC
Permalink
Post by Miroslav Suchý
# config_opts['build_log_fmt_name'] = "unadorned"
# config_opts['root_log_fmt_name'] = "detailed"
# config_opts['state_log_fmt_name'] = "state"
and there is /etc/mock/logging.ini
So it should work somehow, but I never done it.
Yes, this work for logging from mock/plugins itself.
I mean, how to log from site-defaults.cfg / ~/.mock/config.cfg and so on?

As I see, this files readed in mock.py like

642 config_opts = util.load_config(config_path, options.chroot, uidManager,
__VERSION__, PKGPYTHONDIR)

and *after* that, there is

656 # configure logging
657 setup_logging(config_path, config_opts, options)

But before this time there is logging.WARNING default level.
So, currently I can log from site-defaults.cfg, but just with WARNING level.
and I can't access to options.verbose in site-defaults.cfg-s to manually call
logger.setLevel where there is `-q/-v` options passed.
Post by Miroslav Suchý
https://github.com/rpm-software-management/mock/issues/105
I have one highschool intern who is working on that. Despite the fact that is quite
slow, it should be done this week.
It is interesting/useful too! But a bit like 'hammer' in my case, when I want to
quickly debug/access certain variable/data.
_______________________________________________
buildsys mailing list -- ***@lists.fedoraproject.org
To unsubscribe send
Vit Ry
2017-09-12 09:47:28 UTC
Permalink
Also, I can log into file with logger,
but, any way to know from config where resultdir is located?
Or access options.verbose dict?
_______________________________________________
buildsys mailing list -- ***@lists.fedoraproject.org
To unsubscribe send an email to buildsys-lea

Loading...