Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 867507
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T09:59:16+00:00 2026-05-15T09:59:16+00:00

I am writing a rather large JavaScript software. I need to trace calls, log

  • 0

I am writing a rather large JavaScript software. I need to trace calls, log events, debug actions, while maintain performance and portability across browsers.

Webkit and Firebug both offer console object with methods like trace(), log(), error(), warning(), etc. They are great, but what do I do when the browser is IE or Opera?

Imagine having a big application, you surely want to see all initializations it is doing, events it is making, etc., thus I make it log those. However, if I just log those, the logging will not work in browsers that do not have console registered in the DOM. I could create a wrapper object:

MyNamespace.Console = {};
MyNamespace.Console.log = function(value) {
 if (console!==undefined) {
  console.log(value);
 }
 else {
  // What should I do to log events on other browsers?
 }
}

The above makes so no problems occur on IE / Opera, but how do I log with IE (one really needs logging with IE!).

Also, if I plant logs everywhere in my application, does it slow me down when it is being run on a production environment? Should I have a switch DEBUG on/off and a simple check before logging that if DEBUG===true, then log?

What about systems like Closure Compiler, can you make them to remove logging?

What if there is an error while running on production environment and logging has not happened, how do you debug/find the problem? And in fact, do you ever send JavaScript error logs to you (developer), to make sure your clients are not having problems? How does that work out?

I appreciate any feedback/comments on debugging/logging with JavaScript, this is my first time writing a huge JavaScript application, and frankly, I am not sure what should I do about this… debugging and logging in JavaScript seems a bit unfinished.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T09:59:16+00:00Added an answer on May 15, 2026 at 9:59 am

    I wouldn’t recommend having the application report log data back to the developer—at least not without disclosing this to users/clients first.

    It would be a safer practice to log errors/events/debugging data to an array initially as Anurag suggests, and then periodically send the log data to the web server where it can be stored locally and cycled. Then if the client is having problems, they can pull up the logs themselves for debugging and, either, send it to you manually, or explicitly tell the application to transfer the logs to you, the developer.

    Logging to the console is generally used during development anyway. And a debug flag should be used for that so that it won’t be turned on at all times.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am writing a rather large JavaScript based application and sometimes there are cases
I am writing an iPad app that downloads a rather large .csv file and
I've inherited some rather large static HTML files that need to be fixed up
I've got a rather large plugin that I am currently writing in jQuery which
What is the best practice for writing a rather large wcf service, containing a
I've inherited a rather large WPF application, and I need to generate application traces
I'm writing a program that generates a large log file (+10GB) on completion. To
I've been tasked with writing a load/save function for a rather large form. This
I'm writing a rather large script that will have to process a lot of
I am currently writing some extensive documentation using Sphinx for a rather complex Django

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.