Is it possible to redirect the output of GWT.log() from the development console to a file? I need to debug a compiled GWT app and any logging or exception traces would be really nice.
GWT.log is compiled out, there is no way to get access to it when compiled to production.
On the other hand, GWT now has support for java.util.Logging, which can, when compiled in, send errors to the server for use however you want. It also can print these logging statements to a in-browser console, such as a popup or Firebug/Chrome Inspector. See http://code.google.com/webtoolkit/doc/latest/DevGuideLogging.html#Remote_Logging (and other sections on that page) for more details.
Keep in mind that unless you compile in full stack trace info, the exceptions will be very hard to read. See http://code.google.com/p/google-web-toolkit/wiki/WebModeExceptions#Emulated_Stack_Data for more info.
There is no way for a browser (without dev mode running) to write to a local file, for logging or other reasons. This is done for security reasons. Html5 might have support for some of these things, but they won't be supported in older browsers.
Related
Can someone please explain what the point is of source maps? Because as I see it, my concatenated and minified file gets loaded (talking about JavaScript), alongside 100+ modules. How is this not affecting performance when I'm loading twice the size as before?
The point of a source map is that you can run minified Javascript or transpiled Javascript (which is not particularly readable in a debugger by itself), but when you open the debugger, the source map is loaded by the debugger and it gives you a readable form of your source for debugging purposes. The source map is not loaded if the browser is not configured for source map debugging.
Source maps are also extremely useful if you are transpiling code from something like TypeScript or ES6 down to ES5 Javascript so you can see the actual code that you wrote originally in the debugger rather than only the transpiled and minified output.
The alternative before the days of source maps was to have separate versions of your site or options on your site that would load non-minified JS so that you could debug with normal symbols, but this of course isn't actually debugging the exact same code so even then, this could still leave you having to try to debug minified code.
You can read here about how source maps are enabled in the Chrome debugger. If you're watching what is downloaded by the browser, then make sure that you are using a browser that does not have source maps enabled when checking if they are downloaded.
Because you only load the sourcemap when you open the debugger.
Actual users, who don't open the debugger, still get the benefit of the minification.
A source map is a developer tool. It's practical to know the original source when an error occurs within minified source, so you can track down the source of the error.
Source maps are thus only loaded by debuggers, and will not be loaded by default. However, you should consider disabling source maps for production environments, because debug data usually shouldn't be on production environments: for performance and (more importantly) security reasons
I am using AppEngine, NodeJS (Standard), I have accepted the license agreements, and I am initializing the Debug Agent this way:
require('#google-cloud/debug-agent').start({ allowExpressions: true });
I can see all the logs for my application in the Logs Viewer, all the requests are here.
When opening the Stackdriver Debugger, it recognizes what is the current source code running, and displays it. I try adding a few snapshots and logpoints, as basic as this:
if (true) logpoint("Hello World!")
It is waiting for hits, but obviously missing them. There are also no logs related to my logpoints. However, I can see the standard logs outputted by my app. Everything seems to work except the Stackdriver Debugger, even though it doesn't seem to complain either.
I have looked at everything and made sure everything was set up properly but I am not sure how to "debug the debugger" further.
Is it actually even working, and people are using it with NodeJS in Standard mode?
What can I check? Any way I can see errors related to the Debugger itself?
Prior to the „request” statement, how did you set up your project in Stackdriver Debugger for node.js? You may check Setting Up Stackdriver Debugger for Node.js as reference.
To reproduce this issue, one needs confidential information, such as details of your project and sample code. It is much easier to protect your information in the Public Issue Tracker. You are encouraged to open a similar issue there.
When an app is run via Xcode the result of fputs("Hello World", stdout) appears in the Xcode console. Where does it go when Xcode is not attached? Does the answer change for Debug vs. Release builds? You would think that information such as this would be easy to obtain; surprisingly not.
Update: Hmmm, no answer. The reason that I used fputs as an example is that it explicitly references stdout. But swift's print() function also outputs to stdout. An alternate question might be: What reasons, beyond performance, are there for eliminating print() statements from release builds:
When a GUI app is running under MacOS anything written to the "standard output" is sent to the console, which in turn is written to the console log. The easiest way to view the log is to use the Console app found in Utilities.
As to your alternative question reducing what your app writes to the console avoids cluttering up the console log with useless stuff - just take a look and see the amount of non-useful stuff some apps dump out. As a possible metric, if you as app developer will never ask a user to report something your app has written to the console then your app should not write it there, i.e. don't litter!
Is there an equivalent of the browser console in AIDE? It took me trial and error to find out that it doesn't seem to support local storage (or at least the library that I'm usings implementation of it)
Should I wrap everything in one big try Catch block? I've googled and searched, I suspect I should be doing better error handling.
Here's what I ended up doing. You can share the published web app from aide when you're running it. Open it in Firefox for Android after downloading the console add-on. It's not as fully featured as a desktop version but it's close
It feels like poor form to answer ones own question, I earnt the tumbleweed badge for this so perhaps I can be forgiven!
Where is the Log.d file stored on the Android phone? Or is it stored on the phone? I want to use it to inspect the results of try/catch when the app crashes. The app doesn't crash in the debugger or on an Android 4.1 phone, but it crashes on a Froyo phone. I'm trying to trace which line(s) the crash is coming from.
Update:
I learned how to debug directly on the phone with USB debugging. It is easier than I thought, and faster than the emulator. It would still be nice to know where the Log.d file is kept though.
You can trace your lines by Log.d in logcat in debug section.
Generally use the Log.v() Log.d() Log.i() Log.w() and Log.e() methods.(section -VERBOSE, DEBUG, INFO, WARN,ERROR respectively)
The order in terms of verbosity, from least to most is
ERROR, WARN, INFO, DEBUG, VERBOSE.
Verbose should never be compiled into an application except during development.
Debug logs are compiled in but stripped at runtime. Error, warning and info
logs are always kept.