Difference between revisions of "Posting Logs"

From MythTV Official Wiki
Jump to: navigation, search
(Getting Useful Logs: Tell users to start with default-verbosity logs--reading 10M lines of garbage to find the blatantly-obvious-at-default-verbosity message is annoying)
(Getting Useful Logs: Reword to try to prevent problems with users deleting syslog files and not knowing to restart the syslog daemon or getting bad permissions on its files)
 
(8 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 
Frequently, when attempting to resolve a problem, users will be asked
 
Frequently, when attempting to resolve a problem, users will be asked
for logfiles. Using a pastebin and suppling the returned URL is a good
+
for log files. Following are several tips to ensure you provide useful
way to provide that data when using a mailing list or on IRC.
+
log files.
  
{{Note box|This method is '''not''' to be used when posting logfiles
+
== General Information ==
for trouble tickets in ''Trac''. Use its ''Attach file'' button for logs
 
and <code>--version</code> output.}}
 
  
 
=== Getting Useful Logs ===
 
=== Getting Useful Logs ===
  
To get useful logfiles, ensure that only relevant information is shown in the file, but without trimming any information from the logfile.  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 logfile).  At this point, you may decide to delete all existing logfiles, so that you can easily find which one(s) to post.  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.
+
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 <code>-v</code> 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 <code>-v all</code>), important messages will get buried in the noise.
 
Note, also, that generally when diagnosing issues, you should start at default verbosity, and only add additional <code>-v</code> 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 <code>-v all</code>), important messages will get buried in the noise.
  
=== Quick start ===
+
=== Where are the log files stored? ===
<pre>
+
This depends on the distribution and or personal configurations.
pastebinit <logfileName>
 
</pre>
 
  
The above puts the logfile in a pastebin and returns its URL, such as:
+
First, some distributions have commands to help find files. For
 +
example, type either of these:
 
<pre>
 
<pre>
http://paste.ubuntu.com/1405788/
+
locate --regex 'mythbackend.*log'
 +
find / -type f -name 'mythbackend*log'
 
</pre>
 
</pre>
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 logfile 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.
 
<pre>
 
mythbackend version: master [v0.27-pre2-278-g3eef99e]
 
</pre>
 
and chop off everything above it.
 
{{Note box|Be sure that lines with text similar to this are in the log: <code>mythbackend version: master [v0.27-pre2-278-g3eef99e] www.mythtv.org</code> and <code>Enabled verbose msgs:</code>}}
 
 
=== Where are the logfiles stored? ===
 
This depends on the distribution and or personal configurations.
 
 
Typical locations are <code>/var/log/syslog</code> and files under
 
Typical locations are <code>/var/log/syslog</code> and files under
 
<code>/var/log/mythtv</code>. If necessary, typing <code>ps ax | grep mythProgramName | grep -v grep</code>
 
<code>/var/log/mythtv</code>. If necessary, typing <code>ps ax | grep mythProgramName | grep -v grep</code>
 
will display the options used by a running MythTV program. Most likely
 
will display the options used by a running MythTV program. Most likely
that will be <code>mythbackend</code>. See [[Logging]] for more detail.
+
that will be <code>mythbackend</code>. See [[Logging]] for more command line detail.
 +
Or, just type any command followed by <code>--help</code>.
  
If running a command manually, the logfile can be placed in <code>/tmp</code>. For example:
+
If running a command manually, the log file can be placed (for example)
 +
in <code>/tmp</code>. For example:
 
<code>mythshutdown --lock -v general --loglevel info --logpath /tmp</code>.
 
<code>mythshutdown --lock -v general --loglevel info --logpath /tmp</code>.
  
 
=== Why bother? ===
 
=== Why bother? ===
Providing an entire logfile gives the person attempting to  
+
Providing an entire log file gives the person attempting to  
 
diagnose a problem the MythTV version information. It also
 
diagnose a problem the MythTV version information. It also
 
provides events leading up to an error.
 
provides events leading up to an error.
 
Also, be it a terminal, email client or some pastebins, long lines from
 
Also, be it a terminal, email client or some pastebins, long lines from
logfiles frequently get folded. Which is easier to read, this:
+
log files frequently get folded. Which is easier to read, this?:
 
<pre>
 
<pre>
 
2012-12-02 08:56:09.859586 C [3008/3008] thread_unknown mythcommandlineparser.cpp:
 
2012-12-02 08:56:09.859586 C [3008/3008] thread_unknown mythcommandlineparser.cpp:
Line 74: Line 61:
 
...
 
...
 
</pre>
 
</pre>
or this:
+
or this?:
 
<pre>
 
<pre>
 
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.859586 C [3008/3008] thread_unknown mythcommandlineparser.cpp:2545 (ConfigureLogging) - mythbackend version: master [v0.27-pre2-278-g3eef99e-dirty] www.mythtv.org
Line 89: Line 76:
 
</pre>
 
</pre>
  
=== What if <code>pastbinit</code> isn't on a system? ===
+
== 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.
 +
{{Note box|This method is '''not''' to be used when [[#Posting Logs to a ticket in Trac|posting log files
 +
for trouble tickets in ''Trac'']]. Use its ''Attach file'' button for logs
 +
and <code>--version</code> output.}}
 +
 
 +
=== Quick start ===
 +
<pre>
 +
pastebinit <logFileName>
 +
</pre>
 +
 
 +
The above puts the log file in a pastebin and returns its URL, such as:
 +
<pre>
 +
http://paste.ubuntu.com/1405788/
 +
</pre>
 +
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.
 +
<pre>
 +
mythbackend version: master [v0.27-pre2-278-g3eef99e]
 +
</pre>
 +
and chop off everything above it.
 +
{{Note box|Be sure that lines with text similar to this are in the log: <code>mythbackend version: master [v0.27-pre2-278-g3eef99e] www.mythtv.org</code> and <code>Enabled verbose msgs:</code>}}
 +
 
 +
=== What if <code>pastebinit</code> isn't on a system? ===
 
If the program doesn't exist, it will be necessary to
 
If the program doesn't exist, it will be necessary to
use the distributions package manager to get a copy.
+
use the distribution's package manager to get a copy.
 
Readers are encouraged to update this Wiki with their
 
Readers are encouraged to update this Wiki with their
 
distribution's method.
 
distribution's method.
Line 111: Line 127:
 
</pastebinit>
 
</pastebinit>
 
</pre>}}
 
</pre>}}
 +
 +
== Posting Logs to a ticket in Trac ==
 +
 +
When asked to provide log files for a trouble ticket in [http://code.mythtv.org/trac/ Trac], click the <code>Attach File</code> button under the <code>Attachments</code> 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.
  
 
[[Category:HOWTO]]
 
[[Category:HOWTO]]

Latest revision as of 22:30, 6 November 2013

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.