Difference between revisions of "Tutorials webOS Debugging 101"

From WebOS Internals
Jump to navigation Jump to search
m (Fixed some punctuation and spelling. Added <code> tags to commands that are to be issued in PuTTY.)
Line 1: Line 1:
If you're results are not what you expected use JavaScripts try/catch/finally block statements to localize the problem. The first thing you want to do is get as close as possible to where you believe the error is occuring. If you're not sure where, start at the beginning.
+
If your results are not what you expected, use JavaScript's try/catch/finally block statements to localize the problem. The first thing you want to do is get as close as possible to where you believe the error is occurring. If you're not sure where, start at the beginning.
  
  
Line 13: Line 13:
 
<p>connection type: ssh</p>
 
<p>connection type: ssh</p>
  
<p>when command line opens type root</p>
+
<p>when command line opens, type <code>root</code></p>
 
<p>no password just hit enter</p>
 
<p>no password just hit enter</p>
  
<p>type: cat /var/log/messages | grep payment</p>
+
<p>type: <code>cat /var/log/messages | grep payment</code></p>
  
 
<p>"payment" is the string you are searching for with grep</p>
 
<p>"payment" is the string you are searching for with grep</p>
  
 
<p>after you log in to putty:</p>
 
<p>after you log in to putty:</p>
<p>mojo.log.error writes to /var/log/messages</p>
+
<p>Mojo.Log.error writes to /var/log/messages</p>
  
 
<p>cat: types the file out</p>
 
<p>cat: types the file out</p>

Revision as of 21:09, 30 July 2010

If your results are not what you expected, use JavaScript's try/catch/finally block statements to localize the problem. The first thing you want to do is get as close as possible to where you believe the error is occurring. If you're not sure where, start at the beginning.


Add mojo.logs to your code and evaluate them in putty.

Mojo.Log.error("****V" + " my variable: " + this.variable );


putty.exe (for emulator)

ip address "localhost" port 5522

connection type: ssh

when command line opens, type root

no password just hit enter

type: cat /var/log/messages | grep payment

"payment" is the string you are searching for with grep

after you log in to putty:

Mojo.Log.error writes to /var/log/messages

cat: types the file out

grep: searches it for the string following grep and prints out those lines

| (vertical bar): says pass the output of cat over to grep


SIDE NOTE: if you copy text into the clipboard, you can paste it into putty by right-clicking in putty.