Posting Logs

From MythTV Official Wiki
Jump to: navigation, search

Frequently, when attempting to resolve a problem, users will be asked for log files. Following are several tips to ensure you provide useful log files.

General Information

Getting Useful Logs

To get useful log files, ensure that only relevant information is shown in the file, but without trimming any information from the log file. The easiest way to do this is to shut down your MythTV system (or at minimum, the application for which you are attempting to create a log file). At this point, you may decide to delete all existing log files (assuming you're using MythTV file logging) or truncate them (assuming you're using syslog logging), so that you can easily find which one(s) to post and so that it contains only relevant information. Then, restart mythbackend, then mythfrontend, and perform those actions required to cause the failure you're investigating. At this point, exit mythbackend and mythfrontend, then post the logs.

Note, also, that generally when diagnosing issues, you should start at default verbosity, and only add additional -v options when requested (or, if diagnosing the issue yourself, after determining that the default verbosity logs do not show any information helpful in diagnosing the issue). If you instead start with a too-verbose log setting (such as -v all), important messages will get buried in the noise.

Where are the log files stored?

This depends on the distribution and or personal configurations.

First, some distributions have commands to help find files. For example, type either of these:

locate --regex 'mythbackend.*log'
find / -type f -name 'mythbackend*log'

Typical locations are /var/log/syslog and files under /var/log/mythtv. If necessary, typing ps ax | grep mythProgramName | grep -v grep will display the options used by a running MythTV program. Most likely that will be mythbackend. See Logging for more command line detail. Or, just type any command followed by --help.

If running a command manually, the log file can be placed (for example) in /tmp. For example: mythshutdown --lock -v general --loglevel info --logpath /tmp.

Why bother?

Providing an entire log file gives the person attempting to diagnose a problem the MythTV version information. It also provides events leading up to an error. Also, be it a terminal, email client or some pastebins, long lines from log files frequently get folded. Which is easier to read, this?:

2012-12-02 08:56:09.859586 C [3008/3008] thread_unknown mythcommandlineparser.cpp:
2545 (ConfigureLogging) - mythbackend version: master [v0.27-pre2-278-g3eef99e-dirty]
www.mythtv.org
2012-12-02 08:56:09.859608 C [3008/3008] thread_unknown mythcommandlineparser.cpp:2547
 (ConfigureLogging) - Qt version: compile: 4.8.1, runtime: 4.8.1
2012-12-02 08:56:09.859613 N [3008/3008] thread_unknown mythcommandlineparser.cpp:2549
 (ConfigureLogging) - Enabled verbose msgs:  general
2012-12-02 08:56:09.859699 N [3008/3008] thread_unknown logging.cpp:852 (logStart) -
Setting Log Level to LOG_INFO
2012-12-02 08:56:09.860504 I [3008/3008] thread_unknown signalhandling.cpp:194
(SetHandlerPrivate) - Setup Interrupt handler
2012-12-02 08:56:09.860514 I [3008/3008] thread_unknown signalhandling.cpp:194
(SetHandlerPrivate) - Setup Terminated handler
2012-12-02 08:56:09.860522 I [3008/3008] thread_unknown signalhandling.cpp:194
 (SetHandlerPrivate) - Setup Segmentation fault handler
2012-12-02 08:56:09.860529 I [3008/3008] thread_unknown signalhandling.cpp:194
(SetHandlerPrivate) - Setup Aborted handler
2012-12-02 08:56:09.860536 I [3008/3008] thread_unknown signalhandling.cpp:194
(SetHandlerPrivate) - Setup Bus error handler
2012-12-02 08:56:09.860543 I [3008/3008] thread_unknown signalhandling.cpp:194
(SetHandlerPrivate) - Setup Floating point exception handler
...

or this?:

2012-12-02 08:56:09.859586 C [3008/3008] thread_unknown mythcommandlineparser.cpp:2545 (ConfigureLogging) - mythbackend version: master [v0.27-pre2-278-g3eef99e-dirty] www.mythtv.org
2012-12-02 08:56:09.859608 C [3008/3008] thread_unknown mythcommandlineparser.cpp:2547 (ConfigureLogging) - Qt version: compile: 4.8.1, runtime: 4.8.1
2012-12-02 08:56:09.859613 N [3008/3008] thread_unknown mythcommandlineparser.cpp:2549 (ConfigureLogging) - Enabled verbose msgs:  general
2012-12-02 08:56:09.859699 N [3008/3008] thread_unknown logging.cpp:852 (logStart) - Setting Log Level to LOG_INFO
2012-12-02 08:56:09.860504 I [3008/3008] thread_unknown signalhandling.cpp:194 (SetHandlerPrivate) - Setup Interrupt handler
2012-12-02 08:56:09.860514 I [3008/3008] thread_unknown signalhandling.cpp:194 (SetHandlerPrivate) - Setup Terminated handler
2012-12-02 08:56:09.860522 I [3008/3008] thread_unknown signalhandling.cpp:194 (SetHandlerPrivate) - Setup Segmentation fault handler
2012-12-02 08:56:09.860529 I [3008/3008] thread_unknown signalhandling.cpp:194 (SetHandlerPrivate) - Setup Aborted handler
2012-12-02 08:56:09.860536 I [3008/3008] thread_unknown signalhandling.cpp:194 (SetHandlerPrivate) - Setup Bus error handler
2012-12-02 08:56:09.860543 I [3008/3008] thread_unknown signalhandling.cpp:194 (SetHandlerPrivate) - Setup Floating point exception handler
...

Posting Logs to the Mailing List or IRC

Using a pastebin and supplying the returned URL is a good way to provide that data when using a mailing list or on IRC.

Important.png Note: This method is not to be used when posting log files for trouble tickets in Trac. Use its Attach file button for logs and --version output.

Quick start

pastebinit <logFileName>

The above puts the log file in a pastebin and returns its URL, such as:

http://paste.ubuntu.com/1405788/

which can be cut and pasted to the #mythtv-users IRC channel or to a response on the mythtv-users mailing list.

It would be wise to check the size of a log file before doing this. If the file has days/months of data in it, edit the file. Go to the end and search backwards for a string that looks similar to this.

mythbackend version: master [v0.27-pre2-278-g3eef99e]

and chop off everything above it.

Important.png Note: Be sure that lines with text similar to this are in the log: mythbackend version: master [v0.27-pre2-278-g3eef99e] www.mythtv.org and Enabled verbose msgs:

What if pastebinit isn't on a system?

If the program doesn't exist, it will be necessary to use the distribution's package manager to get a copy. Readers are encouraged to update this Wiki with their distribution's method.

For *buntu:

sudo apt-get install pastebinit

A note on customization

By adding a file like this, users can save their pastebinit preferences:

Script.png ~/.pastebinit.xml

<pastebinit>
    <pastebin>http://paste.ubuntu.com</pastebin>
    <author>theNameUsedInThePost</author>
    <format>text</format>
</pastebinit>

Posting Logs to a ticket in Trac

When asked to provide log files for a trouble ticket in Trac, click the Attach File button under the Attachments section of the trouble ticket. Please do not provide links to online pastebin or file hosting services, as the log file may be expired before the ticket is resolved or may still provide useful historical troubleshooting information long after the ticket is resolved.