Skip to content

Disable system log in TNS 4 console #3727

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
tdhman opened this issue Jul 5, 2018 · 14 comments · Fixed by #5679
Closed

Disable system log in TNS 4 console #3727

tdhman opened this issue Jul 5, 2018 · 14 comments · Fixed by #5679

Comments

@tdhman
Copy link

tdhman commented Jul 5, 2018

Hello,

I'am using NativeScript Vue for developing my app, however, since upgrading to TNS 4, the tns console output log is too much verbose with system logging messages. Is there any way to disable all these logs and print only application level logs ?

Every time I run the app, it's impossible to see my debug log since there are a lot of system logs, for example:

AVAudioSession.mm:323:HandleRouteChange: Posting AVAudioSessionRouteChangeNotification. Reason: 3
0x10293e818 - UIProcess is releasing a foreground assertion because the view is no longer visible
0x10b944210 - ProcessThrottler::updateAssertion() sending PrepareToSuspend IPC
0x1c4a6ab80 - ProcessAssertion::setState(1)
0x10b944000 - WebProcessProxy::didSetAssertionState(Background) taking background assertion for network process
0x10b940138 - ProcessThrottler::updateAssertionNow() updating process assertion state to 1 (foregroundActivities: 0, backgroundActivities: 1)
0x1c4a6a980 - ProcessAssertion::setState(1)
0x10b944210 - ProcessThrottler::updateAssertionNow() updating process assertion state to 0 (foregroundActivities: 0, backgroundActivities: 0)
0x1c4a6ab80 - ProcessAssertion::setState(0)
0x10b944000 - WebProcessProxy::didSetAssertionState(Suspended) release all assertions for network process
0x10b940138 - ProcessThrottler::updateAssertion() sending PrepareToSuspend IPC
0x10b940138 - ProcessThrottler::updateAssertionNow() updating process assertion state to 0 (foregroundActivities: 0, backgroundActivities: 0)
0x1c4a6a980 - ProcessAssertion::setState(0)
0x1c4854640 - WKProcessAssertionBackgroundTaskManager - endBackgroundTask
0x10b944210 - ProcessThrottler::updateAssertionNow() updating process assertion state to 1 (foregroundActivities: 0, backgroundActivities: 1)
0x1c4a6ab80 - ProcessAssertion::setState(1)
0x1c4854640 - WKProcessAssertionBackgroundTaskManager - beginBackgroundTaskWithName
0x10b944000 - WebProcessProxy::didSetAssertionState(Background) taking background assertion for network process
0x10b940138 - ProcessThrottler::updateAssertionNow() updating process assertion state to 1 (foregroundActivities: 0, backgroundActivities: 1)
0x1c4a6a980 - ProcessAssertion::setState(1)
0x10b944000 - WebProcessProxy::didSetAssertionState(Background) taking background assertion for network process
0x10b944000 - WebProcessProxy::didSetAssertionState(Background) taking background assertion for network process
0x10b944000 - WebProcessProxy::didSetAssertionState(Background) taking background assertion for network process
0x10b944000 - WebProcessProxy::didSetAssertionState(Background) taking background assertion for network process
0x10b944000 - WebProcessProxy::didSetAssertionState(Background) taking background assertion for network process
0x10b944000 - WebProcessProxy::didSetAssertionState(Background) taking background assertion for network process
0x10b944210 - ProcessThrottler::updateAssertion() sending PrepareToSuspend IPC
0x10b944000 - WebProcessProxy::didSetAssertionState(Background) taking background assertion for network process
0x10b944000 - WebProcessProxy::didSetAssertionState(Background) taking background assertion for network process
0x10b944000 - WebProcessProxy::didSetAssertionState(Background) taking background assertion for network process
0x10b944000 - WebProcessProxy::didSetAssertionState(Background) taking background assertion for network process
0x10b944000 - WebProcessProxy::didSetAssertionState(Background) taking background assertion for network process
0x10b944000 - WebProcessProxy::didSetAssertionState(Background) taking background assertion for network process
0x10b944000 - WebProcessProxy::didSetAssertionState(Background) taking background assertion for network process
0x10b944000 - WebProcessProxy::didSetAssertionState(Background) taking background assertion for network process
0x10b944000 - WebProcessProxy::didSetAssertionState(Background) taking background assertion for network process

Issue occurs since TNS 4.0

  • Both iOS/Android

To recreate the issue

  • Execute command tns [run|debug] [ios|andorid] for any NativeScript project.

Thank you for any help.

@NickIliev NickIliev changed the title Disable system log in TNS 4 console [Vue] Disable system log in TNS 4 console Jul 5, 2018
@speigg
Copy link

speigg commented Aug 7, 2018

This is a headache for debugging. Any workarounds yet?

@speigg
Copy link

speigg commented Aug 7, 2018

@NickIliev This issue is not specific to Nativescript Vue. When running on iOS, the console gets flooded with system logs related to networking, geolocation services, etc.

@speigg
Copy link

speigg commented Aug 7, 2018

The only workaround I have so far is to manually edit ios-log-filter.js by adding additional filtering conditions:

preFilter(data, currentLine) {
        return currentLine.length < 1 ||
            currentLine.indexOf("WebProcessProxy") !== -1 ||
            currentLine.indexOf("ProcessAssertion") !== -1 ||
            currentLine.indexOf("ProcessThrottler") !== -1 ||
            currentLine.indexOf("locationd") !== -1 ||
            currentLine.indexOf("SecTaskCopyDebugDescription") !== -1 ||
            currentLine.indexOf("NativeScript loaded bundle") !== -1 ||
            (currentLine.indexOf("assertion failed:") !== -1 && data.indexOf("libxpc.dylib") !== -1);
}

This is obviously a hack (and still misses a ton of system logs), but at least (for now) I can filter out the noisiest system logs so I can see more of my own.


EDIT:

This works better...

preFilter(data, currentLine) {
        return currentLine.length < 1 || currentLine.indexOf("CONSOLE") === -1 ;
}

@NickIliev NickIliev changed the title [Vue] Disable system log in TNS 4 console Disable system log in TNS 4 console Aug 8, 2018
@GrEg00z
Copy link

GrEg00z commented Oct 22, 2018

@speigg thanks for your workaround, it works great 👍

Thing that I don't understand is there was a PR which has been created for this problem :
https://github.com/NativeScript/nativescript-cli/pull/3389/files

But while using real iOS device, we still get too many useless logs, but if we use Xcode, then the debugger console is clear and contains only useful log.

So there is certainly a solution to get the Xcode logs, instead of current nativescript iOS logs

@fhackenb
Copy link

fhackenb commented Nov 6, 2018

I'm having the same issue, @speigg @GrEg00z where is the ios-log-filter.js file located?

@wolfgang-s
Copy link

wolfgang-s commented Nov 12, 2018

easy workaround: tns debug ios --bundle | grep CONSOLE

If you need to see the chrome devtools link:

tns debug ios --bundle | grep 'CONSOLE|chrome'

Still, this is just a workaround, you will not see any fatal errors from nativescript etc ... so you need to adjust the grep command ...

@kenny-evitt
Copy link

This seems to be either the same issue or at least related to #3544.

One problem with filtering, e.g. with grep, is that it's effectively impossible to see object dumps (e.g. the output of console.dir(object); in the app code).

@lambourn
Copy link

Any concerns/objections to have @speigg 's solution as the default for ios-log-filter.js?

This works better...

preFilter(data, currentLine) {
        return currentLine.length < 1 || currentLine.indexOf("CONSOLE") === -1 ;
}

@GrEg00z
Copy link

GrEg00z commented Jun 12, 2019

Any concerns/objections to have @speigg 's solution as the default for ios-log-filter.js?

This works better...

preFilter(data, currentLine) {
        return currentLine.length < 1 || currentLine.indexOf("CONSOLE") === -1 ;
}

No sir, you can go 👍

@RacknerFrank
Copy link

@GrEg00z where can this ios-log-filter.js file be found?

@lambourn
Copy link

@RacknerFrank depending on where your (global) node modules are located it's

$YOUR_NODE_HOME/node_modules/nativescript/lib/services/ios-log-filter.js

@kenny-evitt
Copy link

@lambourn Wouldn't that strip all console.dir(object); output?

@GrEg00z
Copy link

GrEg00z commented Jun 12, 2019

@RacknerFrank : on windows 10, it's located here :

  • C:\Users\your user\AppData\Roaming\npm\node_modules\nativescript\lib\services
  • C:\Users\your user\AppData\Roaming\npm\node_modules\nativescript\lib\common\mobile

As said @kenny-evitt, the right one should be in nativescript\lib\services, but not sure, I edited the both to be sure

@speigg
Copy link

speigg commented Jun 12, 2019

FYI I haven’t looked at this in a long time so I don’t remember the details, but if I recall correctly I don’t think my workaround works for multi-line console output. (I could be wrong).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants