Nativescript: console.dir not showing full object

Created on 8 Jul 2018  路  9Comments  路  Source: NativeScript/NativeScript

Did you verify this is a real problem by searching the NativeScript Forum and the other open issues in this repo?

Yes

Tell us about the problem

console.dir() isn't showing full object but a part.

Which platform(s) does your issue occur on?

Both

Please provide the following version numbers that your issue occurs with:

  • CLI: (run tns --version to fetch it) 4.1.2
  • Cross-platform modules: (check the 'version' attribute in the
    node_modules/tns-core-modules/package.json file in your project) 4.1.0
  • Runtime(s): (look for the "tns-android" and "tns-ios" properties in the
    package.json file of your project) 4.1.3, 4.1.1

Please tell us how to recreate the issue in as much detail as possible.

console.dir(app.android.startActivity); or any big objects

JS: ==== object dump start ====
JS: constructor()
JS: isNativeScriptActivity: "true"
JS: _callbacks: {}
JS: __parent()
JS: __child()
JS: onCreate()
JS: onNewIntent()
JS: onSaveInstanceState()
JS: onStart()
JS: onStop()
JS: onDestroy()
JS: onBackPressed()
JS: onRequestPermissionsResult()
JS: onActivityResult()
JS: super: com.tns.NativeScriptActivity@bff4fc8
JS: <init>()
JS: addContentView()
JS: attachBaseContext()
JS: closeContextMenu()
JS: closeOptionsMenu()
JS: createPendingResult()
JS: dismissDialog()
JS: dismissKeyboardShortcutsHelper()
JS: dispatchGenericMotionEvent()
JS: dispatchKeyEvent()
JS: dispatchKeyShortcutEvent()
JS: dispatchPopulateAccessibilityEvent()
JS: dispatchTouchEvent()
JS: dispatchTrackballEvent()
JS: dump()
JS: enterPictureInPictureMode()
JS: findViewById()
JS: finish()
JS: finishActivity()
JS: finishActivityFromChild()
JS: finishAffinity()
JS: finishAfterTransition()
JS: finishAndRemoveTask()
JS: finishFromChild()
JS: getActionBar()
JS: getApplication()
JS: getCallingActivity()
JS: getCallingPackage()
JS: getChangingConfigurations()
JS: getComponentName()
JS: getContentScene()
JS: getContentTransitionManager()
JS: getCurrentFocus()
JS: getFragmentManager()
JS: getIntent()
JS: getLastNonConf...

But before it showed full logs.

Most helpful comment

I'm getting something similar to this on iOS, logs are being cut off. I can't find any mention of maxLogcatObjectSize in the iOS documentation, is there a similar flag for it?

All 9 comments

Hi @jibon57,
I investigate further this case and found that this is created by design because in some cases the dumped content in the console was more than it is needed. Review issue #1026. Currently, the messages sent to logcat are automatically truncated after 1024 symbols. However, you can control the message size while setting up maxLogcatObjectSize Check this comment.

I'm getting something similar to this on iOS, logs are being cut off. I can't find any mention of maxLogcatObjectSize in the iOS documentation, is there a similar flag for it?

Similar problem on iOS. Maybe somebody help?

Hi guys; to my knowledge their isn't a setting like that on iOS. I maintain a list of flags http://fluentreports.com/blog/?p=581

However, what I have seen before many times is an issue with NODE when it is processing the data it truncates it. What you can try doing is depending on if it is a simulator or real device is this blog:
http://fluentreports.com/blog/?p=545

And see if your information is truncated still outside of TNS. If it is NOT truncated; then the issue is with the CLI; if it is truncated; then maybe they did add a flag that I haven't seen... ;-)

I have the same problem, this must not be closed, i need to print large JSON objects or also a pay receipt from the app store (sandbox environment) but it gets stripped on IOS, i tried;

  • idevicesyslog
  • cfgutil syslog
  • search about NODE log limitations but found nothing relevant

Even just getting the full error context of some logs would be amazing.
How am I meant to understand what this is if it's truncated?
image

@Eonfuzz you could try debugging using chrome Dev tools for see full logs but you can only see it if the error happens after the app has been started and fully connected to the dev tools and not before 馃槥

Rather annoying that it is truncated...

set the maxLogcatObjectSize in the app/package.json to a number and it will show. Bigger number means bigger log.

{
    "android": {
        "v8Flags": "--expose_gc",
        "markingMode": "none",
        "maxLogcatObjectSize": 2048
    },
    "main": "main",
    "name": "sfgdsfg",
    "version": "1.0.0"
}

Was this page helpful?
0 / 5 - 0 ratings

Related issues

valentinstoychev picture valentinstoychev  路  70Comments

mspusta78 picture mspusta78  路  59Comments

morningrat picture morningrat  路  67Comments

dbbk picture dbbk  路  54Comments

rclai picture rclai  路  52Comments