-
Notifications
You must be signed in to change notification settings - Fork 80
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
No javascript console in the browser #10
Comments
Are you expecting the console.log to come out into the browser log or the server log? The "console.error" statement is running on the server, so perhaps you're expecting that to come out into the logcat of the server. Unfortunately this doesn't happen automatically - console.error goes to the stderr of the application process, but by default Android just sends this to /dev/null. You can get Android to redirect stderr and stdout to logcat if you do the following in an Android shell: echo "log.redirect-stdio=true" > /data/local.prop Hope this helps |
thank you for your help ! I tried doing "setprop log.redirect-stdio true" in the android shell, and I have this line [log.redirect-stdio]: [true] when I run getprop. I think I shall have the err message in my Logcat when I start the server, but nothing, here is the log : 09-25 15:46:27.235: I/ActivityManager(1647): START {act=android.intent.action.MAIN cat=[android.intent.category.HOME] flg=0x10200000 cmp=com.android.launcher/com.android.launcher2.Launcher u=0} from pid 1647 |
Perhaps that mechanism for setting the redirect property works only on phones and isn't enabled on your development board. Can you try writing to a file and confirm you can see the output there? I'm working on a new console object that will be a native node module that will write directly to logcat but maybe writing to a file will do what you need in the short term. |
I tried outputting to a file, this works well using 'fs', But for the stdio, I have these messages in my logcat : 09-27 11:17:30.945: D/AndroidRuntime(2622): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<< I have run my javascript with adb shell am broadcast -a org.meshpoint.anode.START -e cmdline /data/tmp/hello.js, The problem seems to be in these lines : I don't understand what AndroidRuntime was trying to do with the thread 'Binder_3'...these messages weren't there if I don't enable the log.redirect-stdio. |
After working on this feature last week, I have written a native module enabling logs to logcat on C++, and I modified the console.js so that for the android system, the console will use my methods to write logs. I insert the native module and his head into the node src, and I changed this file : <node_extensions.h> to register my module. |
ok, that sounds interesting. Are you able to share the code? |
I did the pull request to your node repo v0.6-android. |
I have compiled anode with node v0.6-android, my device is a pandaboard ES running linaro android 4.1.1. The compilation was successful, and I installed the .apk in the android OS.
For testing it, I use a hello world script :
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/html'});
res.end('Hello World\n');
}).listen(1337, '127.0.0.1');
console.error('Server running at http://127.0.0.1:1337/');
I put the path to the script file in the application window and click "start", then I open my browser and tap 172.0.0.1:1337. Now the problem is that I have the 'Hello Word' message in the page without the javascript console log. I have enabled the option "show javascript console", but it doesn't appear. I can even read the console in other web pages.
So what could be the problem ?
The text was updated successfully, but these errors were encountered: