facebookarchive / nuclide

An open IDE for web and native mobile development, built on top of Atom
https://nuclide.io
Other
7.79k stars 683 forks source link

React native console.log not showing in the console view. #899

Closed nanandn closed 6 years ago

nanandn commented 7 years ago

The log messages printed from the application using console.log are not showing the 'Console' view. I only see messages from React Native Packager. I started the 'Logs' as explained in https://nuclide.io/docs/platforms/ios/#simulator-logs.

Versions

Additional Details

├── atom-beautify@0.29.13 ├── atom-formatter-jsbeautify@1.1.2 ├── atom-material-ui@1.3.6 ├── autoclose-html@0.23.0 ├── git-plus@5.25.3 ├── haskell-grammar@0.4.0 ├── highlight-selected@0.11.2 ├── language-babel@2.48.4 ├── language-ini@1.16.0 ├── language-ocaml@1.1.2 ├── language-swift@0.5.0 ├── language-thrift@1.0.2 ├── merge-conflicts@1.4.4 ├── nuclide@0.183.0 ├── nuclide-format-js@0.0.36 ├── sort-lines@0.14.0 └── tool-bar@1.0.1

tsenterd commented 7 years ago

hey just curious are you getting any errors in the console? @nanandn

matthewwithanm commented 7 years ago

Hey @nanandn! Do you see the logs if you relax the "tags to include" setting under "Nuclide-ios-simulator-logs"?

screen shot 2016-11-29 at 2 13 45 pm
nanandn commented 7 years ago

@tsenterd I am not seeing any errors in the console.

nanandn commented 7 years ago

@matthewwithanm Thanks. yes The log shows once I relax the setting. I changed it to '^(.*)$' and I see the logs now. Is this a right setting? What are those tags?

matthewwithanm commented 7 years ago

The tags are our way of recognizing which items are coming from React Native, but it seems like they're not being applied in some cases (or maybe we're not parsing them correctly).

@yungsters Anything spring to mind here?

nanandn commented 7 years ago

@matthewwithanm Thank you for the explanation.

jtokoph commented 7 years ago

Possibly related:

Is there some way to get the logged messages while the debugger is running?

wellyshen commented 7 years ago

@matthewwithanm What's the right way to set the "tags to include" ? Currently I just follow the @nanandn 's solution, set it to "^(.*)$".

yungsters commented 7 years ago

@nanandn Can you confirm that this is only an issue when remote debugging via the Nuclide debugger (as @jtokoph described)?

wellyshen commented 7 years ago

When does this issue will be fixed?

alexhhn commented 7 years ago

Any news about this issue?

matthewwithanm commented 7 years ago

@wellyshen @alexhhn Sorry, @yungsters is trying to help debug.

yungsters commented 7 years ago

@nanandn, @wellyshen, or @alexhhn: Can any of you confirm that this is only an issue when remote debugging via the Nuclide debugger (as @jtokoph described)?

wellyshen commented 7 years ago

@yungsters

I can see my console.log on Chrome devtool and I wasn't start debugging, here is my step :

alexhhn commented 7 years ago

The same as wellyshen

anarasimhan commented 7 years ago

@yungsters The console log don't appear even if you are not using the debugging. When I change the tags to ''^(.*)$' it works.

yungsters commented 7 years ago

@wellyshen, @alexhhn, and @anarasimhan: Thanks for the extra information.

I tried reproducing the problem, but I am unable to. Can you try looking in the iOS Simulator's System Log (Menu Bar > Debug > Open System Log...) and look for your console.log(...) messages there? If so, can you share what those are?

For example, I see the following in my System Log:

Mar  7 21:06:23 yungsters-mbp Facebook[71888]: 2017-03-07 21:06:23.596 [info][core.react][tid:com.facebook.react.JavaScript][] Expected console log message.
wellyshen commented 7 years ago

@yungsters I only can find the console.log of Nuclide, can you explain how to access system log more specific? Maybe give us an image?

yungsters commented 7 years ago

@wellyshen Select your iOS Simulator. In the Menu Bar, under the Debug menu, select the "Open System Log..." option. This should open a new window with System Logs.

From there, use the search feature to look for your console.log message. Please share the entirety of that log message.

wellyshen commented 7 years ago

@yungsters Here's my log, does the info enough?

Mar 8 15:44:11 Weide-MacBook-Pro WorkoutTube[30915]: === MY LOG ===

It seems my log on iOS's console.log works fine, but it can't show on the Nuclide's console view. Unless I use the ^(.*)$ instead of the default settings.

yungsters commented 7 years ago

@wellyshen Hmm, looks like the iOS Simulator logs are for some reason missing the standard tags that Nuclide uses as the default filter. Thanks for the help.

wellyshen commented 7 years ago

@yungsters It seems my log on iOS's console.log works fine, but it can't show on the Nuclide's console view. Unless I use the ^(.*)$ instead of the default settings.

chipanda commented 7 years ago

I did not seen the console.log in nuclide console with errors in chrome console:./host/InspectorFrontendHost.js:653 Incompatible embedder: method InspectorFrontendHost.platform is missing. Using stub instead.

wellyshen commented 7 years ago

Any update for this?

hfossli commented 7 years ago

Should it work from device as well? Does those settings in iOS Simulator Logs apply to device as well? I guess not?

wellyshen commented 7 years ago

Any update for this?

cristiantx commented 7 years ago

I'm having the same issue as @chipanda https://github.com/facebook/nuclide/issues/899#issuecomment-287685554. Console with a lot of errors and inspectors doesn't seem to work. If I use the default chrome debugger that opens from packager it shows the logs ok.

image

agersoncgps commented 7 years ago

I do not get logs in Atom / Nuclide with or without the remote debugger enabled. CHanging the tags to include does fix it.

mesbahsabur commented 7 years ago

+1

wellyshen commented 7 years ago

Any update?

yungsters commented 7 years ago

I think I have it figured out.

Internally at Facebook, we have configured React Native via RCTSetLogFunction to log not only the message, but also [core.react]. This is how we differentiate logs coming from React Native apart from the rest of our app.

@matthewwithanm Is there a mechanism to configure the default tag filter in Nuclide differently internally? The current default is very specific to our internal environment.

Solution: Use ^(.*)$ as your tag filter in Nuclide.

matthewwithanm commented 7 years ago

@yungsters We don't tag messages at all in open source? Having no filter (^.*$) isn't really a solution because the console gets spammed with irrelevant logs.

yungsters commented 7 years ago

@matthewwithanm We do not. If you take a look at https://github.com/facebook/nuclide/issues/899#issuecomment-284969651, the output is entirely up to how developers happen to integrate React Native into their mobile apps.

matthewwithanm commented 7 years ago

Ugh. Maybe we have to go back to tailing that one random file. I'd much prefer having React's messages tagged in some way that we could identify though. @frantic do you have any ideas here?

wellyshen commented 7 years ago

Sorry, may I know any update for this issue?

matthewwithanm commented 7 years ago

@wellyshen No updates currently, sorry! For now, you need to change the filter like you're already doing.

wellyshen commented 7 years ago

Okay, I just want to remind that console.log is one of the most important debug way for many developers. We're eager for hearing the fixing of this issue.

winsonet commented 7 years ago

I have the same issue, but I don't want to set the log filter to ^(.*)$, because it will show a lot of other system messages and keep to loop to show :(

wellyshen commented 7 years ago

use ^(.*)$ on xCode 9 simulator can't work...

mostafaeweda commented 6 years ago

That should be fixed in the latest RN debugger release.

wellyshen commented 6 years ago

@modocache Which version of nuclide?

I'm use v0.286.0 of nuclide. Even I use ^(.*)$. It still not show the console.log().

RN: 0.50.3 Nuclide: 0.286.0 NodeJS: 9.1.0 RN App OS: 11 iOS-simulator: 10.0

mostafaeweda commented 6 years ago

It’s currently in master (if you build from source) and will be in next week’s release

wellyshen commented 6 years ago

@mostafaeweda

OK, thank you a lot ;) Should I still need to use ^(.*)$ to filter my console.logs?

jayeshjain24 commented 6 years ago

This is the best link that explains logging with chrome devtools : https://codeburst.io/react-native-debugging-tools-3a24e4e40e4