Hi all,
Reading YaST logs, especially from installation or upgrade might be very
difficult. The log is very long and contains every detail of the YaST run. Even
a
default openSUSE Leap 15.4 installation where you basically just press Next,
Next,...
produces about a 13MB log file (uncompressed) with more than 80.000 lines!
Navigating in such a log is very difficult, you can see every tiny detail what
was
done, but it is hard to see the big picture, why was that happening, what was
the goal.
Also some code parts are repeated during the installation. For example
evaluating
the base product is done several times during installation, in the self-update
step,
when displaying the base product license, when registering the system... So if
you
see in the log the base product evaluation you cannot be sure to which step that
belongs.
To improve the situation I have implemented two things:
- enhanced logging
- a new log viewer
Enhanced logging
----------------
I have added a new logger call to YaST, "log.group" call. It logs special
markers
around the passed code block:
log.group "Description of the group" do
foo
end
Then you can easily know where that block started and where it finished.
The groups can be nested, you can have a big group consisting of several
smaller subgroups.
See more code examples in [1] or [2].
You can add this call to your code to structure the log better.
Usage
-----
Here are some real examples which show using the new call in two packages.
- ProductControl - controls the installation workflow, now each installation
step is wrapped in a separate log group [3]
- Registration - each registration step now has separate log group [4]
Log Viewer
----------
To take advantage of the new log messages we need a new log viewer.
I created an experimental web based log viewer at
https://lslezak.github.io/ylogviewer
It can load a local y2log file or an archive created by the "save_y2log" script
(a *.tar.(bz2|gz|xz) file). It can also load a remote file from a specified URL.
It provides basic filtering functions so you can hide some messages depending
on the
log lever or the component. Click the "Filter" button in the top right corner.
It is a static web page and it uses some HTML5 features, the files are processed
completely locally. See the notes on the main page.
(Note: Martin found out that it cannot read tarballs in FireFox, reading plaing
text
logs works fine. Use Chrome/Chromium browser, that works fine. Later I'll look
at
this problem...)
The source code is available in [5], ideas or pull requests with improvements
will be
appreciated. :-)
So far it is hosted in my GitHub account, if it is useful I can move it to the
"yast" organization later.
Example Log
-----------
I uploaded an example log with the new features so you can see how it looks in
the new viewer. See link [5] below, click the "Load URL" button, scroll to the
bottom to see the new grouped sections.
Enjoy!
Ladislav
[1]
https://github.com/yast/yast-ruby-bindings/blob/df4390875bbaed6c2cc8d4a47b5ff9e7d69bab06/src/ruby/yast/y2logger.rb#L137-L152
[2] https://github.com/yast/yast-ruby-bindings/pull/287
[3] https://github.com/yast/yast-yast2/pull/1278
[4] https://github.com/yast/yast-registration/pull/583
[5] https://github.com/lslezak/ylogviewer
[6]
https://lslezak.github.io/ylogviewer/?log_url=https%3A%2F%2Fgist.githubusercontent.com%2Flslezak%2Fd36a2a15b9ccd49f035c7e51b4818ee5%2Fraw%2Fa8f2822f608f7ae0bbabb3dbe457b5202e21da25%2Fy2log-tw-installation.tar.xz
--
Ladislav Slezák
YaST Developer
SUSE LINUX, s.r.o.
Corso IIa
Křižíkova 148/34
18600 Praha 8