[mythtv] Patch: Event log in database
Joseph A. Caputo
jcaputo1 at comcast.net
Sun Feb 22 10:04:57 EST 2004
On Saturday 21 February 2004 23:17, Matt White wrote:
> Attached is a patch I've been working on. This patch adds a logging
> function that logs to a table in the database. With the patch applied,
> a new method is added to gContext:
>
> gContext->LogEntry(const QString &module, int priority,
> const QString &message, const QString &details);
>
> where
> module is the name of the Myth module logging the event
> (ie. mythbackend, mythfilldatabase, etc).
>
> priority is the level of importance of the event, from the following
> choices:
>
> enum LogPriorities {
> LP_DEBUG = 1,
> LP_INFO = 2,
> LP_NOTICE = 3,
> LP_WARNING = 4,
> LP_ERROR = 5,
> LP_CRITICAL = 6,
> LP_EMERG = 7
> };
>
> message is a short summary message for the event
>
> details is an optional more detailed message
>
> Also attached is a little perl script that can be run periodically to
> email log events.
>
> The reason I've added this function is so that we have some way of
> displaying messages to the user without having to ssh into your Myth
> box to check logs. I've got this patch installed on my parents' Myth
> machine. That way, it emails me every couple of days, and I can keep
> track of any problems they're having more easily.
>
> I've also created a MythLog module, which will show events via the
> Myth interface. I'll likely create a patch for MythWeb to display
> the log as well if this patch is accepted.
>
> The patch is against CVS as of Feb. 21, 20:08 CST. I've attached
> the perl script (mythmaillog.pl) as a separate file, since cvs diff
> won't include new files.
>
> My patch adds a few log calls (in mythbackend and mythfilldatabase) -
> I've been going through the code and adding log calls in places where
> I thought they were appropriate. If this patch gets applied,
> Isaac and the other module writers will probably have better ideas
> about what needs logging.
>
> My patch also adds the code to dbcheck.cpp to create the mythlog table,
> upgrading the dbschemaversion to 1034.
>
> This patch does apply against 0.14, with the exception of a couple of
> log calls in mythbackend (starting mythbackend).
>
> The MythLog module can be found at:
>
> http://borris.usask.ca/mythtv/mythlog.tar.gz
>
> A screenshot is also available:
>
> http://borris.usask.ca/mythtv/mythevent.jpg
>
> I've put the patch and perl script up there, too, just in case they
> don't come through with this message:
>
> http://borris.usask.ca/mythtv/logpatch.diff
> http://borris.usask.ca/mythtv/mythmaillog.pl
>
> The patch should be applied with 'patch -p1 < logpatch.diff' at the
> top of the MythTV tree.
>
> The MythLog module unfortunately shows off my complete uselessness
> with designing pretty user interfaces :-)
>
> Any patches or suggestions are welcome.
Ummm... how do you prevent this logging from filling up your disk? With the
current method (logging to a text file), I use logrotate to keep my
mythbackend log from getting too big. If you're logging to the database
instead, I'd think you'd need some way of enforcing a max number of log
entries, or a mechanism for expiring entries of a certain age.
-JAC
More information about the mythtv-dev
mailing list