[Gnucash-changes] r12999 - gnucash/trunk/lib/libqof/qof - Re-enable logging for GnuCash modules that haven't explicitly set their

Neil Williams linux at codehelp.co.uk
Sat Jan 28 16:02:46 EST 2006


On Saturday 28 January 2006 6:58 pm, Chris Shoemaker wrote:
> > Chris, the API for this is qof_log_set_global - please don't mess up the
> > log_check function because this breaks pilot-qof behaviour!
>
> Neil, please read the code.
> 1) qof_log_set_global doesn't exist.
> 2) qof_log_set_level_global does.

OK, typo in the email. Sorry.

> 3) This patch actually changes qof_log_set_level_global, so I
> obviously know about it.

Why should QOF support logging of modules that aren't explicitly set to log?

If a module is has no log level it should be completely ignored. Just because 
it uses ENTER(" ") and has a QofLogModule declared static, why must it always 
be set to log whenever qof_log_set_level_global is called?

> > I would like this patch reverted and a call to qof_log_set_global set in
> > gnucash-bin.c (or somewhere else that is gnucash-specific).
>
> Umm, it's already been in gnucash-bin.c for quite a while.  It doesn't
> do what you think it does.

It enables logging for modules that have not had their log levels set - it is 
exactly what I didn't want. Mea culpa for not making that clear in the docs.

> > Incompatible with pilot-qof and other qof programs which ONLY enable
> > --debug when the option is explicitly added to the command line.
>
> No, it's not incompatible with anything.

It is, if a module has no log level set, it should be ignored by all log 
requests. This allows finer control over logging during debugging. There are 
lots and lots of files that are not being logged but which could be useful to 
log only within a debugging environment - i.e. by us.

When it comes to the release, then the number of modules can be scaled down 
without massive changes to the source code (e.g. removing all ENTER(" ") 
macros).

There are also a large number of files that simply use GNC_MOD_GUI for their 
log identification which is wasteful and cumbersome. By differentiating 
between those log modules that are important at a user level and those that 
are only useful in svn builds, I hoped to extend the previous usage.

I'm usually accused of being over-verbose but I accept that I did not make 
this clear at the time.

> > QOF does not log anything unless explicitly requested to do so. It must
> > remain so.
> >
> > > -	/* if log_module not found, do not log. */
> >
> > This is the API.
>
> That's broken.

No, but maybe it's not documented clearly. 
:-(

qof_log_set_level_global only operates on those log modules that are already 
defined in the hash table. qof_log_set_level_global is for changing the level 
of all *known* modules in one call - not setting the level of all *available* 
modules even if they have not explicitly set a log level of their own.

My intention is for other processes to mimic the qof_log_set_default type call 
in their own code to set the _user_level_ debug output modules - i.e. those 
that produce verbose and intelligible debug output that may be of some use to 
moderately advanced users.

Other files that produce lots of %p type output or describe detailed internal 
errors can be left defined for us to use but leave ignored at release time.

Doing that would require changing only one or two lines of code - e.g. if 
there was a gnc_log_set_gui_default() and gnc_log_set_register_default() then 
we could also have a gnc_log_set_debug() which could be commented out prior 
to release. Otherwise, it requires removing all the log macros and the 
QofLogModule static.

At present, pilot-qof does have these modules and I don't want them logged for 
real users, even in the debug output.

Equally, I don't want to make these modules use DEBUG, DETAIL or TRACE because 
these are simply too verbose.

> > I cannot accept this patch into QOF in this form.
>
> Logging is important for debugging.  FTR, you *BROKE* GnuCash's
> logging facility when you decided to move it into libqof.  You had
> plenty of time to fix it and you apparently don't care. 

I do care. (Been v.busy with paid employment due to sickness of various 
co-workers).

I hoped to make debugging easier by allowing more fine control over exactly 
which modules get logged.

> I'm *FIXING* 
> what you broke in a way that's completely compatible with your
> intentions, even though I don't agree with your intentions.

Not sure - I don't think qof_log_set_level_global should even know about 
modules that have not already set a log level.

I'll fix the docs first.

> If you break things and then tell people "This code is mine now.
> Don't fix it" you're going to annoy a lot people.

Not my intention, I merely want to preserve behaviour in the other programs 
that use the API.

I apologise for not keeping the docs in line with my upstream usage.

-- 

Neil Williams
=============
http://www.data-freedom.org/
http://www.nosoftwarepatents.com/
http://www.linux.codehelp.co.uk/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.gnucash.org/pipermail/gnucash-devel/attachments/20060128/c856785d/attachment.bin


More information about the gnucash-devel mailing list