Difference between revisions of "BugSquad/Get Logs"

From Sugar Labs
Jump to navigation Jump to search
 
(30 intermediate revisions by 11 users not shown)
Line 1: Line 1:
== Why ==
+
<noinclude>
 +
[[Category:Testing]]
 +
[[Category:BugSquad]]
 +
[[Category:HowTo]]
 +
</noinclude>
 +
 
 +
 
 +
== What are the logs useful for ==
 
If you provide debugging logs to a ticket, you'll be making it much easier to developers to fix the issue. In most of the cases it will be easiest for you to reproduce the bug.
 
If you provide debugging logs to a ticket, you'll be making it much easier to developers to fix the issue. In most of the cases it will be easiest for you to reproduce the bug.
  
== Enabling debugging ==
+
== The Log Activity ==
  
These are general steps to follow when providing logs for some bug:
+
The [[olpc:Log]] Activity, is a Sugar-based log viewer that is in most distributions to help you view software logs. You can copy text from the view pane into the Sugar clipboard, then from the clipboard keep it into the Journal, and then attach that Journal item into the [http://bugs.sugarlabs.org bugs.sugarlabs.org] or [http://dev.laptop.org dev.laptop.org] [Attach file] > [Browse...] dialogs, or paste relevant pieces directly into the bug description.
  
* Start the Terminal activity.
+
You can use the Log Collector to easily export all logs to the journal in a handy zip bundle:
* Type the following:
+
 
  echo 'export SUGAR_LOGGER_LEVEL=debug' >> /home/olpc/.xsession
+
[[Image:Log Collector.png|615px]]
 +
 
 +
== Enabling Sugar debug logging ==
 +
A shell script file, {{Code|~/.sugar/debug}}, is run when Sugar starts up.  All environment variables exported by the file will be inherited by the Sugar shell and activity processes.
 +
 
 +
From Sugar 0.83 to 0.98, the file is prepared with commented lines.  From Sugar 0.102, the file must be created by you.  Use your editor to add a line, or remove the '#' before the line, to ensure SUGAR_LOGGER_LEVEL is exported with the value ''debug'', like this:
 +
 
 +
export SUGAR_LOGGER_LEVEL=debug
 +
 
 +
From Sugar 0.83 to 0.98, the prepared file looks like this:
 +
<pre>
 +
# Uncomment the following lines to turn on many sugar debugging
 +
# log files and features
 +
#export LM_DEBUG=net
 +
#export GABBLE_DEBUG=all
 +
#export GABBLE_LOGFILE=$HOME/.sugar/default/logs/telepathy-gabble.log
 +
#export SALUT_DEBUG=all
 +
#export SALUT_LOGFILE=$HOME/.sugar/default/logs/telepathy-salut.log
 +
#export GIBBER_DEBUG=all
 +
#export PRESENCESERVICE_DEBUG=1
 +
#export SUGAR_LOGGER_LEVEL=debug
 +
 
 +
# Uncomment the following line to enable core dumps
 +
#ulimit -c unlimited
 +
</pre>
  
* Reboot, or just restart X using ctrl+alt+erase
+
=== Where are the logs placed ===
 
* Perform the minimal steps to reproduce the bug.
 
* Perform the minimal steps to reproduce the bug.
* The relevant logs are in '''/home/olpc/.sugar/default/logs''', (e.g org.laptop.WebActivity-1.log for the log of the first Browse instance). You can copy them to a USB flash drive and attach to the ticket from another computer or use the Browse activity to attach them to the ticket.
+
* The relevant logs are stored in {{Code|~/.sugar/default/logs}}, (e.g, org.laptop.WebActivity-1.log for the log of the first Browse instance).
  
Note: The file datastore.log may contain a list of all the files in your USB flash drive or SD card. Check and delete from there if you don't want to submit that information. Most probably it's not needed by the developers.
+
=== Using sugar-launch ===
  
* Another interesting file to attach to the ticket is /var/log/messages.
+
To enable debug logging for one run of one specific activity, use sugar-launch in Terminal, to set the SUGAR_LOGGER_LEVEL environment variable and start the activity by bundle id:
* You may also use <code>olpc-netlog</code> to gather all logs and XO info to a single file.
+
SUGAR_LOGGER_LEVEL=debug sugar-launch org.laptop.Chat
* [[Log]] is an activity for viewing log files
 
  
=== Other debugging settings ===
+
=== Using the sugar-emulator ===
The file <tt>/home/olpc/.xsession-example</tt> contains other settings useful for debugging. You can copy individual lines from this or copy the entire file to <tt>/home/olpc/.xsession</tt>.
+
If you are using a version older than the development release 0.83, run the emulator with the following command:
 +
SUGAR_LOGGER_LEVEL=debug sugar-emulator
  
 
=== Presence service ===
 
=== Presence service ===
 +
If your bug involves the presence service, you might also want to follow the steps for [[BugSquad/Telepathy Debugging]].
 +
 +
== On the XO-1 (using Sugar 0.82.x)==
 +
These are general steps to follow when providing logs for a bug:
  
If your bug involves the presence service, you might also want to follow the steps for [[BugSquad/TelepathyDebugging]].
+
* Start the Terminal activity.
 +
* Type the following:
 +
  echo 'export SUGAR_LOGGER_LEVEL=debug' >> /home/olpc/.xsession
  
== If you can't reproduce the bug ==
+
* Reboot, or just restart X using ctrl+alt+erase
  
Python-based activities automatically make logs in /home/olpc/.sugar/default/logs. These logs seem to be moved into subfolders on restart and deleted after a certain period of time. The python stack trace is recorded here on crashes. This is also a good thing to attach to a bug. As above, you will have to use the Terminal activity to copy them to removable memory (SD or USB) before using the XO or another computer to attach them to the bug.
+
The file {{Code|~/.xsession-example}} contains other settings useful for debugging. You can copy individual lines from this or copy the entire file to {{Code|~/.xsession}}.
  
 +
== On other machines (Sugar.84)==
 +
Sugar activities have logs
 +
<code>~/.sugar/default/logs/ </code>
 +
so go to
 +
<code>someuser</code>
 +
type
 +
<code> ls -al</code>
 +
then drill down to
 +
<code> ~/.sugar/default/logs/</code>
 +
for the error messages.
  
[[category:BugSquad]]
+
Another useful command is:
 +
<code>dmesg</code>
 +
It prints out all of the kernel's messages and warnings for this session, with any new stuff at the end.

Latest revision as of 07:26, 18 September 2014



What are the logs useful for

If you provide debugging logs to a ticket, you'll be making it much easier to developers to fix the issue. In most of the cases it will be easiest for you to reproduce the bug.

The Log Activity

The olpc:Log Activity, is a Sugar-based log viewer that is in most distributions to help you view software logs. You can copy text from the view pane into the Sugar clipboard, then from the clipboard keep it into the Journal, and then attach that Journal item into the bugs.sugarlabs.org or dev.laptop.org [Attach file] > [Browse...] dialogs, or paste relevant pieces directly into the bug description.

You can use the Log Collector to easily export all logs to the journal in a handy zip bundle:

Log Collector.png

Enabling Sugar debug logging

A shell script file, ~/.sugar/debug, is run when Sugar starts up. All environment variables exported by the file will be inherited by the Sugar shell and activity processes.

From Sugar 0.83 to 0.98, the file is prepared with commented lines. From Sugar 0.102, the file must be created by you. Use your editor to add a line, or remove the '#' before the line, to ensure SUGAR_LOGGER_LEVEL is exported with the value debug, like this:

export SUGAR_LOGGER_LEVEL=debug

From Sugar 0.83 to 0.98, the prepared file looks like this:

# Uncomment the following lines to turn on many sugar debugging
# log files and features
#export LM_DEBUG=net
#export GABBLE_DEBUG=all
#export GABBLE_LOGFILE=$HOME/.sugar/default/logs/telepathy-gabble.log
#export SALUT_DEBUG=all
#export SALUT_LOGFILE=$HOME/.sugar/default/logs/telepathy-salut.log
#export GIBBER_DEBUG=all
#export PRESENCESERVICE_DEBUG=1
#export SUGAR_LOGGER_LEVEL=debug

# Uncomment the following line to enable core dumps
#ulimit -c unlimited

Where are the logs placed

  • Perform the minimal steps to reproduce the bug.
  • The relevant logs are stored in ~/.sugar/default/logs, (e.g, org.laptop.WebActivity-1.log for the log of the first Browse instance).

Using sugar-launch

To enable debug logging for one run of one specific activity, use sugar-launch in Terminal, to set the SUGAR_LOGGER_LEVEL environment variable and start the activity by bundle id:

SUGAR_LOGGER_LEVEL=debug sugar-launch org.laptop.Chat

Using the sugar-emulator

If you are using a version older than the development release 0.83, run the emulator with the following command:

SUGAR_LOGGER_LEVEL=debug sugar-emulator

Presence service

If your bug involves the presence service, you might also want to follow the steps for BugSquad/Telepathy Debugging.

On the XO-1 (using Sugar 0.82.x)

These are general steps to follow when providing logs for a bug:

  • Start the Terminal activity.
  • Type the following:
 echo 'export SUGAR_LOGGER_LEVEL=debug' >> /home/olpc/.xsession
  • Reboot, or just restart X using ctrl+alt+erase

The file ~/.xsession-example contains other settings useful for debugging. You can copy individual lines from this or copy the entire file to ~/.xsession.

On other machines (Sugar.84)

Sugar activities have logs

~/.sugar/default/logs/  

so go to

someuser

type

 ls -al 

then drill down to

 ~/.sugar/default/logs/

for the error messages.

Another useful command is:

dmesg 

It prints out all of the kernel's messages and warnings for this session, with any new stuff at the end.