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.

[0.61.0] Debugging console is not link log to the source

See original GitHub issue

On 0.61.0, every console log is now always pointing to setUpDeveloperTools.js:73 instead of pointing to the source. Not sure if it related to these changes 🤔 (https://github.com/facebook/react-native/commit/81ec2112a15e3d66b7973f0e1aaa8986fcca753f#diff-8863a34349d2a00986749efcf471649c)

It used to work fine on 0.60.4.

image

React Native version:

System:
    OS: macOS Mojave 10.14.5
    CPU: (4) x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
    Memory: 540.27 MB / 16.00 GB
    Shell: 5.3 - /bin/zsh
  Binaries:
    Node: 12.3.1 - /usr/local/bin/node
    Yarn: 1.13.0 - /usr/local/bin/yarn
    npm: 6.9.0 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 13.0, DriverKit 19.0, macOS 10.15, tvOS 13.0, watchOS 6.0
    Android SDK:
      API Levels: 15, 19, 22, 23, 24, 25, 26, 27, 28
      Build Tools: 27.0.3, 28.0.0, 28.0.2, 28.0.3, 29.0.0
      System Images: android-22 | Google APIs Intel x86 Atom, android-24 | Google APIs Intel x86 Atom, android-P | Google Play Intel x86 Atom, android-Q | Google APIs Intel x86 Atom
      Android NDK: 19.2.5345600
  IDEs:
    Xcode: 11.0/11A420a - /usr/bin/xcodebuild
  npmPackages:
    react: 16.9.0 => 16.9.0 
    react-native: 0.61.0 => 0.61.0 
  npmGlobalPackages:
    react-native-cli: 2.0.1

Steps To Reproduce

  1. Launch application in debug mode.
  2. Add console.log somewhere in the code.
  3. Open the debugger console.
  4. Every log is coming from setUpDeveloperTools.js:73

Describe what you expected to happen:

The debugger console should link the log to the source file & number of lines.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:27
  • Comments:18 (2 by maintainers)

github_iconTop GitHub Comments

47reactions
makn3tizacommented, Oct 21, 2019

In the meantime you can “patch” your

/node_modules/react-native/Libraries/Core/setUpDeveloperTools.js

In line 57

replace

if (!Platform.isTesting) {

by

if (!Platform.isTesting && global.nativeLoggingHook) {

and source will be showed up until next RN’s release

Captura de Pantalla 2019-10-21 a la(s) 7 29 09 a  m

7reactions
daihieptn97commented, Oct 31, 2019

In the meantime you can “patch” your

/node_modules/react-native/Libraries/Core/setUpDeveloperTools.js

In line 57

replace

if (!Platform.isTesting) {

by

if (!Platform.isTesting && global.nativeLoggingHook) {

and source will be showed up until next RN’s release

Captura de Pantalla 2019-10-21 a la(s) 7 29 09 a  m

working for me 💯 , thanks you

Read more comments on GitHub >

github_iconTop Results From Across the Web

Chrome: console.log, console.debug are not working
log statements started showing up in the console. Till the time Info level was selected, they were not getting shown.
Read more >
Debugging - React Native
If you're using Create React Native App or Expo CLI, console logs already appear in the same terminal output as the bundler. Debugging...
Read more >
Using console.log() debugging in Visual Studio Code
In the video I use a project I have open with a launch.json file already defined, which means it opens the correct URL...
Read more >
Fix JavaScript errors that are reported in the Console
Click the link to the webpage and line of code where the error occurs, to open the Sources tool. That is, click the...
Read more >
Debugging in Visual Studio Code
A Logpoint is a variant of a breakpoint that does not "break" into the debugger but instead logs a message to the console....
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