phonegap / phonegap-cli

PhoneGap and PhoneGap/Build command-line interface
Apache License 2.0
489 stars 157 forks source link

There are no console.log messages #763

Open dustyraven opened 6 years ago

dustyraven commented 6 years ago

PhoneGap CLI, node & npm versions

CLI: 7.1.1, Node: 9.2.1, NPM: 5.6.0

Expected Behaviour

When using phonegap serve to have console messages

Actual Behaviour

No console messages even for errors.

Steps to Reproduce

console.log('anything');

Sample Code that illustrates the problem

console.log('anything');

Error messages

nothing...

I've tried adding plugin cordova-plugin-console - no difference.

surajpindoria commented 6 years ago

Hi @dustyraven,

I just tested this with a new project and am seeing the logs both in the terminal and in the console on the browser. Are you using one of the phonegap templates?

dustyraven commented 6 years ago

yes, that's what I'm using for testing. The only output I see is:

[phonegap] [console.warn] Content Security Policy has been modified to be: meta http-equiv="Content-Security-Policy" content="default-src 'unsafe-inline' gap: ws: https://ssl.gstatic.com;style-src 'self' 'unsafe-inline' data: blob:;media-src ;img-src 'self' data: content:;script-src 'unsafe-inline' 'unsafe-eval' data: blob:;" [phonegap] 200 /api/appzip

surajpindoria commented 6 years ago

Which template are you using? I can confirm that the blank template does not display logs, but when I use the hello-world template logs are showing up correctly.

dustyraven commented 6 years ago

What is the difference? I even don't know how to select some template. I use "phonegap create myapp" and start coding. And I'm expecting console to work (as it was in all of my previous projects). If it's not working - we have a bug I suppose... So I think discussion is pointless. I have one and only question - how to see logs of console?

dustyraven commented 6 years ago

Just tried: phonegap create . --template hello-world phonegap serve

[phonegap] starting app server... [phonegap] listening on 10.48.22.80:3000 [phonegap] [phonegap] ctrl-c to stop the server [phonegap] [phonegap] [console.warn] Content Security Policy has been modified to be: < meta http-equiv="Content-Security-Policy" content="default-src 'unsafe-inline' gap: ws: https://ssl.gstatic.com;style-src 'self' 'unsafe-inline' data: blob:;media-src ;img-src 'self' data: content:;script-src 'unsafe-inline' 'unsafe-eval' data: blob:;" > [phonegap] [console.warn] Content Security Policy has been added: < meta http-equiv="Content-Security-Policy" content="default-src gap: ws: https://ssl.gstatic.com;img-src 'self' data: content:;style-src 'self' 'unsafe-inline' data: blob:;script-src * 'unsafe-inline' 'unsafe-eval' data: blob:;" > [phonegap] 200 /api/appzip [phonegap] 200 /socket.io/socket.io.js [phonegap] 200 /socket.io/?EIO=3&transport=polling&t=M6TtZxX [phonegap] 200 /socket.io/?EIO=3&transport=polling&t=M6Tta0g&sid=iHET54_Z1l3FMfIEAAAA [phonegap] 200 /socket.io/?EIO=3&transport=polling&t=M6Tta1k&sid=iHET54_Z1l3FMfIEAAAA

Again no console output.

dustyraven commented 6 years ago

anybody?

surajpindoria commented 6 years ago

I have been looking into this but since I am unable to reproduce it is difficult to say what could be causing this. Are you also seeing this issue when you install the app to a device?

dustyraven commented 6 years ago

sorry for delay - yes.

TakshPSingh commented 5 years ago

I'm experiencing the same issue. Just an hour ago, the console logs were appearing just fine, but seems to have disappeared suddenly.

UPDATE: They came back after 2 hours and haven't gone since.

StevenMapes commented 5 years ago

Did you change your CSP meta values as doing that could stop access to write to the console depending on the values you choose.

I tend to go back to the default wide open one for testing <meta http-equiv="Content-Security-Policy" content="default-src * 'unsafe-inline' gap:; style-src 'self' 'unsafe-inline'; media-src *" />