How to debug the J2ME Polish MIDlet?
How can I show the logs which are generated?
How to debug the J2ME Polish MIDlet?
How can I show the logs which are generated?
You can easly log statements with J2ME Polish using the following:
//#debug
System.out.println("Error...");
Using //#debug with J2ME Polish indicates a pre-processing directive to log the println statement.
There are various levels of logging, including debug, info, warn, error and fatal. You can define your own logging levels but I find that over exhaustive for most situtations.
The best thing I found was to add a handler to the build file within the debug section.
<handler name="http">
<parameter name="server" value="http://a.server.com:80/Debug/" />
</handler>
Will post any log information straight to a server, so you can literally see the log flow in as your application is running.
Or you can add a handler that logs to an RMS and use the J2ME Polish Logviewer sample application to view the logs stored within the RMS. The can be found in the sample directory of your J2ME Polish installation.
<handler name="rms">
<parameter name="useBackgroundThread" value="false" />
</handler>
Remember to set the varriables in the logview build file. See below:
<variables>
<variable name="polish.log.MIDletSuite" value="Demonstrator" />
<variable name="polish.log.Vendor" value="Enough Software" />
</variables>
I had a collegue at work try to debug via bluetooth but I think this doesn't actually work.
Just a note to any one reading this who is new J2ME, you cannot debug on device! MIDlets and J2ME were first concieved in the late 90's.