[yast-devel] use ALog::Item
Dear hackers, you are all admins of your own workstations, I believe. Have you ever wondered what YaST did to your system? Or even what *you* did to your system a week or a month ago? Please have a look at your y2log now: sudo less /var/log/YaST2/y2log The information is (mostly) there, but it is buried in piles and heaps of debugging information. So yes, as if you did not have enough features to implement already, I am asking you for more. But the users will love it. Please take one (or all) of your modules and put in log messages using the API below. Presumably they are already there, using y2milestone. ALog stands for Admin's log, to remind you who the reader is. ALog::Item("/etc/ntp.conf: added 'server ntp.example.org'") ALog::Item("enabled /etd/init.d/ntp") ALog::Item("started /etd/init.d/ntp") ALog::CommitPopup() will lead to ALog::Note("set up ntp from local server") A prototype is in SVN already: http://svn.opensuse.org/svn/yast/trunk/yast2/library/log/src/ALog.ycp The interface is not set in stone (yet). Please comment and let's find a design that is useful and easy to use. Open questions: - actual log format References: - https://keeper.novell.com/sxkeeper/feature/303700?contenttype=text/html - https://keeper.novell.com/sxkeeper/feature/100386?contenttype=text/html - related log in zypp: http://lists.opensuse.org/zypp-devel/2008-07/msg00043.html -- Martin Vidner, YaST developer http://en.opensuse.org/User:Mvidner Kuracke oddeleni v restauraci je jako fekalni oddeleni v bazenu -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org
On Wed, Aug 06, Martin Vidner wrote:
Dear hackers,
you are all admins of your own workstations, I believe. Have you ever wondered what YaST did to your system? Or even what *you* did to your system a week or a month ago?
Please have a look at your y2log now: sudo less /var/log/YaST2/y2log The information is (mostly) there, but it is buried in piles and heaps of debugging information.
So yes, as if you did not have enough features to implement already, I am asking you for more. But the users will love it.
Please take one (or all) of your modules and put in log messages using the API below. Presumably they are already there, using y2milestone.
ALog stands for Admin's log, to remind you who the reader is.
ALog::Item("/etc/ntp.conf: added 'server ntp.example.org'") ALog::Item("enabled /etd/init.d/ntp") ALog::Item("started /etd/init.d/ntp")
ALog::CommitPopup() will lead to ALog::Note("set up ntp from local server")
Isn't this what the loglevel 6 (E_USR) was intended for? An absract of changes done to the system which is also loged into a separate file. -- cu, Michael Andres +------------------------------------------------------------------+ Key fingerprint = 2DFA 5D73 18B1 E7EF A862 27AC 3FB8 9E3A 27C6 B0E4 +------------------------------------------------------------------+ Michael Andres YaST Development ma@novell.com SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nuernberg) Maxfeldstrasse 5, D-90409 Nuernberg, Germany, ++49 (0)911 - 740 53-0 +------------------------------------------------------------------+ -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org
On Wed, Aug 06, 2008 at 04:57:13PM +0200, Michael Andres wrote:
On Wed, Aug 06, Martin Vidner wrote:
ALog::Item("/etc/ntp.conf: added 'server ntp.example.org'") ALog::Item("enabled /etd/init.d/ntp") ALog::Item("started /etd/init.d/ntp")
ALog::CommitPopup() will lead to ALog::Note("set up ntp from local server")
Isn't this what the loglevel 6 (E_USR) was intended for? An absract of changes done to the system which is also loged into a separate file.
Yes. The basic requirement is simple: better logging. Naturally the design is simple too: a function for the better logging. (I put it into a namespace to make room for its brother, a commit message from the admin.) E_USR and analogically y2user(fmt, ...) seems to imply the constraints shared by the other logging functions: the same log file, the same format... I forgot to mention that I assume it will use a different log file (and additionally use y2log too probably) so that people do not have to call grep to make sense of it. (E_USR is in http://svn.opensuse.org/svn/zypp/trunk/libzypp/zypp/base/Logger.h ) -- Martin Vidner, YaST developer http://en.opensuse.org/User:Mvidner Kuracke oddeleni v restauraci je jako fekalni oddeleni v bazenu -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org
On Wed, Aug 06, 2008 at 05:41:49PM +0200, Martin Vidner wrote:
On Wed, Aug 06, 2008 at 04:57:13PM +0200, Michael Andres wrote:
On Wed, Aug 06, Martin Vidner wrote:
ALog::Item("/etc/ntp.conf: added 'server ntp.example.org'") ALog::Item("enabled /etd/init.d/ntp") ALog::Item("started /etd/init.d/ntp")
ALog::CommitPopup() will lead to ALog::Note("set up ntp from local server")
Isn't this what the loglevel 6 (E_USR) was intended for? An absract of changes done to the system which is also loged into a separate file.
Yes.
The basic requirement is simple: better logging. Naturally the design is simple too: a function for the better logging. (I put it into a namespace to make room for its brother, a commit message from the admin.) E_USR and analogically y2user(fmt, ...) seems to imply the constraints shared by the other logging functions: the same log file, the same format...
Log file and format should be possible to change. The problem with ALog::Item is that it doesn't understand %1 syntax. Always using sformat is clumsy. Also ALog::Item is not accessible from C++ (in case anybody needs that). Access from libstorage seems idealistic since libstorage uses limal/blocxx stuff for logging. ciao Arvin -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org
On Wed, Aug 06, 2008 at 05:53:58PM +0200, Arvin Schnell wrote:
On Wed, Aug 06, 2008 at 05:41:49PM +0200, Martin Vidner wrote:
On Wed, Aug 06, 2008 at 04:57:13PM +0200, Michael Andres wrote:
Isn't this what the loglevel 6 (E_USR) was intended for? An absract of changes done to the system which is also loged into a separate file.
Yes. The basic requirement is simple: better logging. Naturally the design is simple too: a function for the better logging. (I put it into a namespace to make room for its brother, a commit message from the admin.) E_USR and analogically y2user(fmt, ...) seems to imply the constraints shared by the other logging functions: the same log file, the same format...
Log file and format should be possible to change.
I'm not sure what you mean. During the design or at runtime?
The problem with ALog::Item is that it doesn't understand %1 syntax. Always using sformat is clumsy.
Right. It seems I will have to improve core to make it possible.
Also ALog::Item is not accessible from C++ (in case anybody needs that). Access from libstorage seems idealistic since libstorage uses limal/blocxx stuff for logging.
With some work, both should be possible. What other C++ users aside from libstorage would we have? Remember ALog as a YCP module is just a prototype. -- Martin Vidner, YaST developer http://en.opensuse.org/User:Mvidner Kuracke oddeleni v restauraci je jako fekalni oddeleni v bazenu -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org
With some work, both should be possible. What other C++ users aside from libstorage would we have? Remember ALog as a YCP module is just a prototype.
Hm ... package selectors? :) But I can't think of possible use-case there, as it will be (or maybe already is) libzypp that takes care about logging which packages have been installed/deleted/updated and when, for the simple reason that using package selector is not the only means of installing pkg. Other than that, I believe it is yast2-registration that is being currently rewritten to C++ B. -- \\\\\ Katarina Machalkova \\\\\\\__o YaST developer __\\\\\\\'/_ & hedgehog painter
On Thu, Aug 07, 2008 at 03:20:53PM +0200, Martin Vidner wrote:
On Wed, Aug 06, 2008 at 05:53:58PM +0200, Arvin Schnell wrote:
On Wed, Aug 06, 2008 at 05:41:49PM +0200, Martin Vidner wrote:
On Wed, Aug 06, 2008 at 04:57:13PM +0200, Michael Andres wrote:
Isn't this what the loglevel 6 (E_USR) was intended for? An absract of changes done to the system which is also loged into a separate file.
Yes. The basic requirement is simple: better logging. Naturally the design is simple too: a function for the better logging. (I put it into a namespace to make room for its brother, a commit message from the admin.) E_USR and analogically y2user(fmt, ...) seems to imply the constraints shared by the other logging functions: the same log file, the same format...
Log file and format should be possible to change.
I'm not sure what you mean. During the design or at runtime?
I mean it should be easy to implement a new log macro y2user in C++ that logs into a different file with a different format. Accessing that from YCP would also be easy and you get the "%1" things for free. ciao Arvin -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org
On Wed, Aug 06, 2008 at 05:53:58PM +0200, Arvin Schnell wrote:
On Wed, Aug 06, 2008 at 05:41:49PM +0200, Martin Vidner wrote:
On Wed, Aug 06, 2008 at 04:57:13PM +0200, Michael Andres wrote:
On Wed, Aug 06, Martin Vidner wrote:
ALog::Item("/etc/ntp.conf: added 'server ntp.example.org'") ALog::Item("enabled /etd/init.d/ntp") ALog::Item("started /etd/init.d/ntp")
ALog::CommitPopup() will lead to ALog::Note("set up ntp from local server")
Isn't this what the loglevel 6 (E_USR) was intended for? An absract of changes done to the system which is also loged into a separate file.
Yes.
The basic requirement is simple: better logging. Naturally the design is simple too: a function for the better logging. (I put it into a namespace to make room for its brother, a commit message from the admin.) E_USR and analogically y2user(fmt, ...) seems to imply the constraints shared by the other logging functions: the same log file, the same format...
Log file and format should be possible to change.
The problem with ALog::Item is that it doesn't understand %1 syntax. Always using sformat is clumsy.
Also ALog::Item is not accessible from C++ (in case anybody needs that). Access from libstorage seems idealistic since libstorage uses limal/blocxx stuff for logging.
Since I now have a related feature (#305159) I had a look at the feature requests (#100386 and #303700). If logging is really required on such a detailed level then the logging has to be done in libstorage (C++) since the YCP code doesn't have that detailed knowledge. Callbacks would be another possibility. But I suppose logging is also required when libstorage is used by other programs so callbacks would only move the problem to those programs. Have a nice weekend Arvin -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org
* Arvin Schnell <aschnell@suse.de> [Aug 09. 2008 13:58]:
Callbacks would be another possibility. But I suppose logging is also required when libstorage is used by other programs so callbacks would only move the problem to those programs.
Implementing (optional) logging callbacks is a smaller 'problem' than being forced to use a specific, fixed logging implementation. Looking at using libstorage in other programs, I'd prefer logging callbacks. Klaus -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org
On Wed, 6 Aug 2008, Martin Vidner wrote:
On Wed, Aug 06, 2008 at 04:57:13PM +0200, Michael Andres wrote:
On Wed, Aug 06, Martin Vidner wrote:
ALog::Item("/etc/ntp.conf: added 'server ntp.example.org'") ALog::Item("enabled /etd/init.d/ntp") ALog::Item("started /etd/init.d/ntp")
ALog::CommitPopup() will lead to ALog::Note("set up ntp from local server")
Isn't this what the loglevel 6 (E_USR) was intended for? An absract of changes done to the system which is also loged into a separate file.
Yes.
The basic requirement is simple: better logging. Naturally the design is simple too: a function for the better logging. (I put it into a namespace to make room for its brother, a commit message from the admin.) E_USR and analogically y2user(fmt, ...) seems to imply the constraints shared by the other logging functions: the same log file, the same format...
I forgot to mention that I assume it will use a different log file (and additionally use y2log too probably) so that people do not have to call grep to make sense of it.
Can't we get this information from SCR, without calling explicitely some functions (which is going to be error prone)? For instance the example above could be generated from SCR (layer), one would (more or less :) only need .path -> file/function translation to create such a log. Michal -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org
On Wed, Aug 06, 2008 at 10:33:01PM +0200, Michal Svec wrote:
Can't we get this information from SCR, without calling explicitely some functions (which is going to be error prone)?
For instance the example above could be generated from SCR (layer), one would (more or less :) only need .path -> file/function translation to create such a log.
SCR could do it if that was a reuqirement from early on, but I am afraid that it is not quite suited for this use at this point. In other words, it would be rather "much more" than "less" I think. Anyway, we can see how that would look like from watching what goes through SCR: Y2DEBUG=1 (or [Debug] scr=true in log.conf), then egrep -A3 'executeSubagentCommand: (Write|Execute)' y2log For example attached is one such log, which I would like to see described as Note "changed ntp server from ntp.suse.cz to random one from pool.ntp.org" Item "/etc/ntp/conf: server list changed to 0.pool.ntp.org 1.pool.ntp.org 2.pool.ntp.org" Item "/etc/sysconfig/ntp: NTPD_RUN_CHROOTED changed to yes" (hmm, that's a gratuitous change) Item "restarted /etc/init.d/ntp" I encourage people to try this with their own modules and perhaps post the results so that we get a better idea if pursuing this path is worthwhile. -- Martin Vidner, YaST developer http://en.opensuse.org/User:Mvidner Kuracke oddeleni v restauraci je jako fekalni oddeleni v bazenu
On Thu, 7 Aug 2008, Martin Vidner wrote:
On Wed, Aug 06, 2008 at 10:33:01PM +0200, Michal Svec wrote:
Can't we get this information from SCR, without calling explicitely some functions (which is going to be error prone)?
For instance the example above could be generated from SCR (layer), one would (more or less :) only need .path -> file/function translation to create such a log.
SCR could do it if that was a reuqirement from early on, but I am afraid that it is not quite suited for this use at this point. In other words, it would be rather "much more" than "less" I think.
Sure, this was just an idea.
Anyway, we can see how that would look like from watching what goes through SCR: Y2DEBUG=1 (or [Debug] scr=true in log.conf), then egrep -A3 'executeSubagentCommand: (Write|Execute)' y2log
It actually looks somehow similar (up to slight syntax differences) to what you suggested, see the attached output from one run of the yast2 security module. Michal
Michal Svec wrote:
On Thu, 7 Aug 2008, Martin Vidner wrote:
On Wed, Aug 06, 2008 at 10:33:01PM +0200, Michal Svec wrote:
Can't we get this information from SCR, without calling explicitely some functions (which is going to be error prone)?
For instance the example above could be generated from SCR (layer), one would (more or less :) only need .path -> file/function translation to create such a log.
SCR could do it if that was a reuqirement from early on, but I am afraid that it is not quite suited for this use at this point. In other words, it would be rather "much more" than "less" I think.
Sure, this was just an idea.
Anyway, we can see how that would look like from watching what goes through SCR: Y2DEBUG=1 (or [Debug] scr=true in log.conf), then egrep -A3 'executeSubagentCommand: (Write|Execute)' y2log
It actually looks somehow similar (up to slight syntax differences) to what you suggested, see the attached output from one run of the yast2 security module.
See also this thread: # From: "Alexey Eremenko" <al4321@xxxxxxxxx> # Date: Tue, 29 Jul 2008 14:57:24 +0000 # [opensuse] Yast as a Linux learning tool http://lists.opensuse.org/opensuse/2008-07/msg02571.html L.
* Lukas Ocilka <lukas.ocilka@suse.cz> [Aug 08. 2008 13:06]:
See also this thread:
# From: "Alexey Eremenko" <al4321@xxxxxxxxx> # Date: Tue, 29 Jul 2008 14:57:24 +0000 # [opensuse] Yast as a Linux learning tool http://lists.opensuse.org/opensuse/2008-07/msg02571.html
And Fate #100349: "Make YaST logs user-readable" ;-) Klaus -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org
Hi! I've implemented a low-level equivalent of this functionality and commited to trunk. #include <y2util/y2changes.h> This provides 2 functions: y2useritem(format, args...) Function to log an item entry (system action) into the user-level action log y2usernote(format, args...) Function to log a note entry (additional information) into the user-level action log The similar builtins are available for YCP. The values are written to /var/log/YaST2/y2changes log. Comments welcome! Stano Dňa Wednesday 06 August 2008 16:29:00 Martin Vidner ste napísal:
Dear hackers,
you are all admins of your own workstations, I believe. Have you ever wondered what YaST did to your system? Or even what *you* did to your system a week or a month ago?
Please have a look at your y2log now: sudo less /var/log/YaST2/y2log The information is (mostly) there, but it is buried in piles and heaps of debugging information.
So yes, as if you did not have enough features to implement already, I am asking you for more. But the users will love it.
Please take one (or all) of your modules and put in log messages using the API below. Presumably they are already there, using y2milestone.
ALog stands for Admin's log, to remind you who the reader is.
ALog::Item("/etc/ntp.conf: added 'server ntp.example.org'") ALog::Item("enabled /etd/init.d/ntp") ALog::Item("started /etd/init.d/ntp")
ALog::CommitPopup() will lead to ALog::Note("set up ntp from local server")
A prototype is in SVN already: http://svn.opensuse.org/svn/yast/trunk/yast2/library/log/src/ALog.ycp
The interface is not set in stone (yet). Please comment and let's find a design that is useful and easy to use.
Open questions:
- actual log format
References:
- https://keeper.novell.com/sxkeeper/feature/303700?contenttype=text/html - https://keeper.novell.com/sxkeeper/feature/100386?contenttype=text/html - related log in zypp: http://lists.opensuse.org/zypp-devel/2008-07/msg00043.html
-- Martin Vidner, YaST developer http://en.opensuse.org/User:Mvidner
Kuracke oddeleni v restauraci je jako fekalni oddeleni v bazenu
-- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org
participants (8)
-
Arvin Schnell
-
Katarina Machalkova
-
Klaus Kaempf
-
Lukas Ocilka
-
Martin Vidner
-
Michael Andres
-
Michal Svec
-
Stanislav Visnovsky