2

I've implemented the Channel API w/ persistence. When I make a channel and connect the socket (this is on the real app, not the local dev_appserver), Firebug goes nuts with log messages. I want to turn these off so I can see my OWN logs but cant find any documentation on how to disable the Channel API console logging.

one thing I'm probably doing differently than most is that I'm connecting cross-domain... which the Channel API supports (note the first message in the stream... if you can view that pic)

enter image description here

Does anyone know?


UPDATE

I finally realized that my code was creating two channels and trying to open/connect them both at the same time... and that was why I was getting a flood of messages. I didn't mean to do this (I know the rules: https://developers.google.com/appengine/docs/python/channel/overview#Caveats )... it was a bug... and once I fixed it, the messages went back to manageable level.

yay

Nicholas Franceschina
  • 6,009
  • 6
  • 36
  • 51

2 Answers2

1

On the Development server, when using the ChannelAPI, it essentially degrades into a polling implementation instead of using Comet/long-polling. Thus, in your debugger, you see an endless stream of HTTP requests made to the server to continuously and methodically check for updates.

In essence, these are just AJAX requests, or as Firebug would like to think of them, XMLHttpRequests.

Since your browser is responsible for making these requests, the only way to disable them is to click the small arrow on "Console" in Firebug and uncheck the option for logging XMLHttpRequests.

Uncheck XmlHttpRequest Logging in Firebug

Of course, this also disables logging for all of your other XMLHttpRequests. But it's a small price to pay for the clarity and serenity of a quiet, well-behaved JavaScript console.

For more helpful information on how to make the most of Firebug, see Firebug Tips and Tricks.

NOTE: This works for both users of the Python SDK as well as the Java SDK. (or Go SDK, assuming it has an equivalent ChannelAPI). This is not limited to only Python Appengine.

UPDATE:

From getFirebug:

Creates a time stamp, which can be used together with HTTP traffic timing to measure when a certain piece of code was executed.

The console.timeStamp method was released in Firebug 1.8.0. The same technique described above can also override this Firebug logging method.

console.timeStamp("This is the type of console logging statement that Google is using!");

The above logging statement would produce the olive text. This method can be disabled using the same techniques which were described in the previous section.

However, Google loads the console object inside of a closure, which means that, once Google's code is initialized, the ChannelAPI object has it's own copy of the console object.

In order to disable console.timeStamp, one would need to disable it as the very first action before anything else loads or runs. in other words, we would need to ensure that Google only gets its hands on the disabled console.timeStamp method.

For best results, load this code above the /_ah/channel/jsapi script tag to ensure the console.timeStamp method is disabled before jsapi loads:

if(window.console) console.timeStamp = function(t) { };

NOTE: Because Google invokes Firebug logging in this manner, the only solution may very well in fact require a bug report or feature request that would allow for programmatically disabling this level of logging. Alternatively, the Firebug team could provide a new version of Firebug that includes the ability to explicitly disable timeStamp log statements, similar to how they've done so with Errors, Warnings, XMLHttpRequests, and other log levels.

jamesmortensen
  • 33,636
  • 11
  • 99
  • 120
  • thanks... but I suppose my question needs clarification... I wasn't talking about the polling behavior of the dev_appserver. see my edits above – Nicholas Franceschina May 23 '12 at 08:02
  • 1
    If this is still unanswered tomorrow, I'll take a look at it further once I've had a chance to play with my dev server. Thanks for adding the screenshot to your question. That helps! – jamesmortensen May 23 '12 at 08:14
  • 1
    Nick, I don't see those yellow messages in either Firebug 1.9.2 or 1.7.3, even if I turn all the console options on. You might try borrowing code from [this answer](http://stackoverflow.com/a/10712690/552792), systematically disabling your console.info, log, etc functions one at a time until you find the culprit. It might either a) be acceptable for you to disable the specific log function; thus, it would solve your problem, or b) tell us more about how those messages are getting to Firebug. – jamesmortensen May 23 '12 at 17:31
  • 1
    Nick, I've tried every which way I can think of. I can disable timeStamp so that *I can't create timeStamp log statements myself*, but Google's timeStamp log statements still seem to come through. With that said, I'll leave my answer here for documentation purposes. Although it doesn't provide a solution to the problem, I'm sure you and others experiencing this issue will find it helpful, and this information could very well lead to a solution should an Appengine Team developer or Firebug developer drop by. – jamesmortensen May 24 '12 at 02:26
  • 1
    thank you so much for your efforts and help! I have put this effort aside for the time being, but will try to get back to it soon and see what I can figure out. Thanks again! – Nicholas Franceschina May 29 '12 at 21:08
1

There doesn't appear to be a way to shutoff the Firebug timeStamp log. One way to solve this problem is to edit the code and remove this functionality yourself:

Unpack the extension to a directory in your Mozilla Firefox Profile:

Change directory to your Firefox profile extensions directory. On Ubuntu, this would be something like this:

cd ~/.mozilla/firefox/{random-string}/extensions/

The Firebug extension is identified by firebug@software.joehewitt.com.xpi. Create a new directory of the same name, but without the .xpi, and move the XPI into that directory:

mkdir firebug@software.joehewitt.com
mv firebug@software.joehewitt.com.xpi firebug@software.joehewitt.com

Next, change directories to your newly created Firebug directory, and unpack the extension:

cd firebug@software.joehewitt.com
unzip firebug@software.joehewitt.com.xpi

All of the files should be unpacked so that the extension's directories are in the current directory. Your file structure will look something like this:

$: ~/.mozilla/firefox/{random-string}/extensions/firebug@software.joehewitt.com$ l
chrome.manifest  defaults/  firebug@software.joehewitt.com.xpi  install.rdf  locale/   skin/
content/         docs/      icons/                              license.txt  modules/

$: ~/.mozilla/firefox/ghlfe0bb.ff5.0/extensions/firebug@software.joehewitt.com$

Open consoleExposed.js in your text editor:

Next, change to the content/firebug/console directory:

cd content/firebug/console

Edit the consoleExposed.js file using your favorite editor:

vim consoleExposed.js

Disable console.timeStamp:

On or near line 215, you'll see the following function:

console.timeStamp = function(label)
{  
    label = label || "";

    if (FBTrace.DBG_CONSOLE)
        FBTrace.sysout("consoleExposed.timeStamp; " + label);

    var now = new Date();
    Firebug.NetMonitor.addTimeStamp(context, now.getTime(), label);

    var formattedTime = now.getHours() + ":" + now.getMinutes() + ":" +
        now.getSeconds() + "." + now.getMilliseconds();
    return logFormatted([formattedTime, label], "timeStamp");
};

Right after the first curly-brace, force the function to return nothing:

console.timeStamp = function(label)
{   return ;   // disable timestamp by returning
    label = label || "";

    if (FBTrace.DBG_CONSOLE)

Restart Firefox and enjoy a world without timeStamp:

After the edits, restart Firebug. You should no longer see the log messages for timeStamp in your console.

jamesmortensen
  • 33,636
  • 11
  • 99
  • 120