question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[prodMode] Is there any simple way to disable log for production environment?

See original GitHub issue

Currently there is a log message depending on enableProdMode() function being called which ends up with following log in prod mode:

Angular 2 is running in the production mode. Call enableDevMode() to enable the development mode.

How can I prevent Angular from logging such a message?

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

6reactions
davidzastcommented, Dec 6, 2017

This is my workarround, i hope it helps somebody.

In the maint.ts file use this if (environment.production) { enableProdMode(); console.log = function (a, b, c, d, e, f, g, h, i, j, k, l) { return false; } }

0reactions
angular-automatic-lock-bot[bot]commented, Sep 14, 2019

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

Read more comments on GitHub >

github_iconTop Results From Across the Web

The simplest way to disable console.log for Production build in ...
There are various ways you can disable console in the production, such as: By using libraries such as logger; Creating a linting rule...
Read more >
Disabling console.log() in production - Stack Overflow
Solution is to add the polyfill to your polyfill.ts file if(!window.console) { var console = { log : function(){}, warn : function(){}, ...
Read more >
Enabling and Disabling Angular Production Mode - Pluralsight
Let's look at how we can test initial stages without changing the URL every time and being able to change our environment's file...
Read more >
Angular2.x – How to disable Console Logs in Production Build
I will let explain a trick where we can retain all of our console log statements, when in development mode, and disable all...
Read more >
Remove console.log from Production Mode
log is one the debugging weapon or logger we use as javascript developer. The console. log method is a way for developers to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found