Help get this topic noticed by sharing it on Twitter, Facebook, or email.

console.log does no "output" in "Background" and "Popup" context ?

Hello,

I have "seen" in some topics, documentations and demos the use of console.log .

With me, that does not work neither under Firefox or Chrome.
Precisely, there is no error, but there is no "output" in console(s) (native, firebug, ...).

That works only in "extension" context.

Is there a way to unblock this ? Or I've missed anything ?
1 person has
this question
+1
Reply
  • Hello eureka,

    You didn't miss anything per sae, well, maybe the following small topic :)
    How to view console messages

    In particular checkout the sections about viewing the messages in different scopes on different browsers.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated kidding, amused, unsure, silly indifferent, undecided, unconcerned happy, confident, thankful, excited

  • Thanks for the topic (and its related blog article), I missed the two.

    However, I had implemented a similar process than the one in the blog, which sends via messaging the data to the extension scope which uses the console.*() methods, taking benefit from only one console to see all the process logs.

    But, after our discussion in topic "appAPI.message sync in Firefox and async in Chrome ?", I asked myself about the reliability of the order in which logs are displayed. This is why I was interested in the way the console works in all scopes.

    Finally I think the order will be preserved (messaging working probably as a "queue").
    One thing to know is : when a console.log data is "output" in console (via messaging + extension scope), the process has probably already kept on working (and if an external event writes in console, this one can be display in console before the extension scope does it with the received messaging data).

    That's all for me ! Thanks for links.
    • Shlomo (Official Rep) March 01, 2015 09:37
      Hello eureka,

      Since messaging is asynchronous, it's not possible to determine the display sequence of log messages that come from other scopes to a single scope. So whilst it's useful and sometimes necessary to pass logs messages between scopes to see the messages, it does not necessarily represent the correct sequence in which the logs were generated.

      However, you can always add a time stamp (appAPI.time.now) to the log messages so that you can reconstruct the sequence.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated kidding, amused, unsure, silly indifferent, undecided, unconcerned happy, confident, thankful, excited