|
Replies:
9
-
Last Post:
Sep 16, 2008 12:48 AM
by: jaywayjohan
|
Threads:
[
Previous
|
Next
]
|
|
|
|
|
|
Logging in Java ME
Posted:
Apr 17, 2008 9:14 AM
|
|
|
Is there any decent logging mechanism for Java ME? I know there's a couple of open-source projects that do it, so was wondering does anybody have any experience with those?
I was also wondering how to create my own logger, and was thinking about writing a log to the RMS. But would that be very inefficient for frequent logging of messages?
|
|
|
|
|
|
|
Re: Logging in Java ME
Posted:
Apr 18, 2008 5:35 AM
in response to: davjoh
|
 |
Correct |
|
|
Hi,
JSR 47 is the logging API but unfortunately it never got much traction in Java ME land.
You're right that there are a few open source packages available but I have not yet tried them.
Do you need to log during development? If yes, then with many devices System.out goes to the console on the PC or into a file on the device and you can use that.
If you are looking for logging functionality once your app is deployed to users then your choices for persistent storage is RMS or PIM files. In both cases you'll need to implement caching and LRU policies to minimize the activity on the persistent store as some devices are very slow in accessing flash storage.
-- Terrence
|
|
|
|
|
|
|
|
Re: Logging in Java ME
Posted:
Apr 21, 2008 12:43 PM
in response to: terrencebarr
|
|
|
Awesome, thanks Terrence.
Yes, logging to console is easy enough, and that's how I do stuff at the moment.
But I was thinking of some way of logging once it's deployed to a phone, and as you point out, it's not neccessarily too straight forward.
Another consideration of course is making sure to be able to get the logs back to a PC or server somewhere!
I think I'll stick with trusty old System.out for now...
|
|
|
|
|
|
|
|
Re: Logging in Java ME
Posted:
Jun 18, 2008 5:39 AM
in response to: davjoh
|
|
|
I would recommend that you try out MicroLog: http://sourceforge.net/projects/microlog
It is compatible with Log4j, but is built from ground up to make it possible to run in a Java ME. If you are familiar with Log4j, it should be easy to get going.
You could log to System.out, a RecordStore or a file (which could be transferred to a PC via USB). It also has support for some easy formatting.
BTW a new version is now out. Please try it out. Feedback is very welcome!
|
|
|
|
|
|
|
|
|
|
Re: Logging in Java ME
Posted:
Jun 20, 2008 4:09 PM
in response to: terrencebarr
|
|
|
You know, I actually just recently started a project on java.net to do some more advanced logging in Java ME. More of a Logger/Debugger actually. So far the console logger, network logger and bluetooth logger are finished.
I know some sony ericssons allow you to do bluetooth debugging, but not in linux, and only with those ericsson devices, just too limited for me. So, off I went to do something for the community, and hope that other people could use the same solution to the common on-device debugging issues that I've come across in the past years.
check it out, maybe add it to the LoggingResource wiki if you think it's appropriate? https://logmeadvanced.dev.java.net/
Message was edited by: pandora808
|
|
|
|
|
|
|
|
Re: Logging in Java ME
Posted:
Jun 23, 2008 7:02 AM
in response to: pandora808
|
|
|
pandora808,
Great. Also posted to the wiki. PS: Of course, the wiki can be edited by any java.net member so feel free to update it yourself as necessary.
-- Terrence
|
|
|
|
|
|
|
|
Re: Logging in Java ME
Posted:
Sep 14, 2008 11:53 PM
in response to: terrencebarr
|
|
|
We have worked very hard to improve Microlog. One of the most important additions is the PatternFormatter, which works like the PatternLayout found in Log4j. We have also added a lot of new appenders:
On-device appenders =================== -ConsoleAppender - Appends to the console, e.g. System.out.' -RecordStoreAppender - Appends to the RecordStore. -FileAppender - Appends to a file using a FileConnection. -CanvasAppender - Appends to a Canvas. -FormAppender - Appends to a Form. Off-device appenders ==================== -BluetoothSerialAppender - Appends to a Bluetooth serial connection (btspp). -SerialAppender - Appends to a serial port (CommConnection). -SmsAppender - Appends to a cyclic buffer and send the buffer as an SMS. -MmsAppender (for MMS and/or e-mail) - Appends to a cyclic buffer and send the buffer as an SMS. -DatagramAppender - Appends to a datagram and send it using UDP. -SyslogAppender - Appends to syslog server. -SocketAppender - Appends to a socket connection (also SSL). -S3FileAppender - Appends to a file, as in the FileAppender, and stores the file on Amazon S3. -S3BufferAppender - Appends to a cyclic buffer and stores it as a file on Amazon S3.
We have also made a Bluetooth server that is executable on both Java ME and Java SE. The setup is dead easy:
1. Pair the Bluetooth devices, e.g. your mobile phone and your laptop. 2. Start the server on your laptop. 3. Start your MIDlet with Microlog included.
That it is! Now you could watch your log on your laptop
|
|
|
|
|
|
|
|
Re: Logging in Java ME
Posted:
Sep 15, 2008 12:16 AM
in response to: jaywayjohan
|
|
|
Correction: The MMSAppender sends and/or MMS or e-mail.
|
|
|
|
|
|
|
|
Re: Logging in Java ME
Posted:
Sep 16, 2008 12:48 AM
in response to: jaywayjohan
|
|
|
Hi,
I have released a new version of Microlog that contains the above mentioned features. I am also proud to announce that a quickstart guide is included.
Please download it from: http://sourceforge.net/projects/microlog/
Please post comments and/or feedback on the Microlog forums.
Happy logging!
Best Regards Johan
|
|
|
|
|