<div class="gmail_quote">2011/6/7 MythTV <span dir="ltr">&lt;<a href="mailto:noreply@mythtv.org">noreply@mythtv.org</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div><div></div><div class="h5">      Author:  Gavin Hurlbut &lt;<a href="mailto:ghurlbut@mythtv.org">ghurlbut@mythtv.org</a>&gt;<br>
 Change Date:  2011-06-07T22:07:58-07:00<br>
   Push Date:  2011/06/07 22:08:51 -0700<br>
  Repository:  mythtv<br>
      Branch:  master<br>
New Revision:  ad8b03b3a83945119ac43b4714cc0782c2abf6cf<br>
   Changeset:  <a href="https://github.com/MythTV/mythtv/commit/ad8b03b3a" target="_blank">https://github.com/MythTV/mythtv/commit/ad8b03b3a</a><br>
<br>
Log:<br>
<br>
Merge branch &#39;new-logging&#39;<br></div></div></blockquote><div><br></div><div>You will absolutely want/need to do make uninstall then make distclean before building this.</div><div><br></div><div>As a synopsis:</div>
<div><br></div><div>The old db logging is gone.  Logging using VERBOSE is now done asynchronously with minimal locking in the thread sending the message (just enough to protect the QQueue).  All log message details are put into a structure, the pointer of which is queued for logging.  The logging thread then dequeues and actually writes to the logfile(s), database, and/or syslog.</div>
<div><br></div><div>Logging can be (and by default is) done to: console, debug logfile (similar to our old logs), database table and syslog (defaults to LOCAL7).</div><div><br></div><div>To disable each...</div><div>console:  --quiet</div>
<div>debug logfile: put no --logfile/--logpath/-l argument</div><div>database table: --nodblog</div><div>syslog: --syslog none</div><div><br></div><div>The debug logfile now also contains extra detail.  In particular, for each log message, the function, filename and line number of the VERBOSE call, and the name of the calling thread are added.  This will aid in the debugging of the codebase as now we can narrow down far easier what precisely is logged and from where.  The downside is that each and every thread now requires a threadRegister(&quot;thread name&quot;) and threadDeregister() call.  I have added to every thread I&#39;ve found (almost 100 in total!).  If the thread is not registered, the logs will show &quot;thread_unknown&quot; instead.</div>
<div><br></div><div>A minor change to the use of VERBOSE:  Please no longer use VERBOSE(VB_LEVEL, string &lt;&lt; value &lt;&lt; string);  This will not compile.  I converted every single one of these to a working equivalent.  The second argument is a QString, not a QStringList.  The use of string + string works, as does QString(&quot;blah %1&quot;).arg(blah).  To print a pointer, the best way is:  QString(&quot;0x%1&quot;).arg((uint64_t)pointer,0,16)  -- these have also all been converted.  If I missed some, sorry. :)</div>
<div><br></div><div>Please note that --logpath now exists.  If --logfile/--logpath/-l is given an argument of a directory, then the debug logfile will be created in that directory as (for example) mythfrontend.pid.log (fill in the pid number).  If it is given an argument of a file (i.e. non-directory), then that will be used as the filename of the debug log.  There are probably a few places where the directory could be propagated into system calls, but aren&#39;t yet.</div>
<div><br></div><div>SIGHUP will close and reopen the debug logfile, for the benefit of those using logrollers.</div><div><br></div><div>Finally, the command line parsing has been completely reworked by Raymond Wagner (and some follow up tweaks by myself).  All binaries (except mythzmserver, I think) use the new command-line parsers, and all use the new logging as well.</div>
<div><br></div><div><br></div><div>If there are issues, by all means, let me know (via email, trac tickets, on IRC, whatever).  This has been a long haul, and there are still things to be done (such as converting some cout and cerr uses to VERBOSE to use the new logging).</div>
</div>