Mobile add-on doc issue: logging



Add-on SDK
4 years ago
4 years ago


(Reporter: Thomas Andersen, Unassigned)


Firefox Tracking Flags

(Not tracked)




4 years ago
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:26.0) Gecko/20100101 Firefox/26.0 (Beta/Release)
Build ID: 20131205075310

Steps to reproduce:

1. Followed this tutorial for setting up the enviroment:
2. Initialized an add-on (cfx init)
3. Added console.log("Hello, mobile!") in lib/main.js
4. Then did a test: cfx run -a fennec-on-device -b adb --mobile-app firefox --force-mobile
5. As described in the doc, used grep for filtering the log

adb logcat | grep info:

Actual results:

The browser was successfully opened on the device, but the "Hello, mobile!" log message was not displayed.

Expected results:

The log message should have been displayed in the log.

The current documentation is wrong regarding the grep command.

The documentation says:

adb logcat | grep info:

This worked for me:

adb logcat | grep I/Gecko

I guess that grep regex could be worked upon in order narrow it down to show only logs.
Any ideas, Jordan?
Flags: needinfo?(jsantell)
I'll update the documentation regarding the grep command. We got rid of the prefixed 'info:' infront of the logs, so that would no longer filter them out.

`adb logcat | grep console.log` worked fine for me

Is the log message printing in your stdout as well? I'm seeing it there, but unsure if you did not see it, or if it's just a documentation issue with grep.
Flags: needinfo?(jsantell) → needinfo?(thomas)

Comment 3

4 years ago
> Is the log message printing in your stdout as well? 


Add-on SDK 1.15 (1de7d0d1dfbda3adfd68b2157fb6f2f3fd9bbedf)
Android Debug Bridge version 1.0.31


% adb logcat | grep console.log

I/stdout  (22749): console.log: add-on-name: true
I/Gecko   (22749): console.log: add-on-name: true
I/stdout  (22749): console.log: add-on-name: true
I/Gecko   (22749): console.log: add-on-name: false


This works well besides of it seems like console.error message is printed on the next line

% adb logcat | grep "I/Gecko.*console"

I/Gecko   (15102): console.log: add-on-name: Hello, world!
I/Gecko   (15102): add-on-name: Hello, world!
I/Gecko   (15102): console.warn: add-on-name: Hello, world!
I/Gecko   (15102): console.error: add-on-name:
Flags: needinfo?(thomas)


4 years ago
Flags: needinfo?(jsantell)
Strange that it prints for all console types, hm.
I don't see that when I run it, but I'm also using an android emulator, wonder if that's leading to the difference. Same version of ADB, though. I know there are other issues with console on android (double printing: bug 866318).

I'll update the docs with additional information, thanks! But for the other weird console stuff that you discover, can you file new bugs for those and I'll check them out then?
Flags: needinfo?(jsantell)
Docs updated on
Last Resolved: 4 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.