Skip to main content

Microlog 2.2.0 Provides Reliable Small-Footprint J2ME and Android Logging

Posted by editor on November 10, 2009 at 5:19 AM PST

Some developers seem to think that logging is not really all that useful or important. I've worked with people who have this view. They think that the only way to solve a problem is to launch your program within an IDE or debugger, insert break points, look at variables, step ahead a statement or five, etc.

This method indeed is suitable for some problems. But it's not by any means suitable for all situations. Take, for example, multithreaded applications. Or, what about the case of very intermittent errors in a critical operational system that runs on a 24/7 basis? If you've got 168 hours a week to sit there running the application manually within your IDE, in parallel with the operational runs, waiting for that once in every 5-32 days anomaly (and really hoping that when it occurs operationally it also occurs within your IDE launched and monitored run) -- well, go right ahead and enjoy yourself!

But, guess what: there's a good chance that these unusual, intermittent failures won't be repeatable, and they won't occur in your IDE or debugger driven run, or any attempted rerun! They're intermittent! So, now what do you do? The damaging failure has occured once again, your boss is hovering over you saying "Well, you were watching it. So what happened, and why?" And you... umm... haven't a clue?

Logging has been an important component of operational systems since the inception of operational computing systems. A log is simply a very basic monitor. What complicated system runs without instrumentation to enable the operators to assess the performance of the system? Are we in a "nominal" state (i.e., nothing unusual stands out), or is something flashing an edge or out-of-bounds condition? That's what logs are for.

OK. So much for lecturing against logging naysayers. Just take it from someone who has decades of experience in the area: logging is of critical importance for operational systems.

That's why the recent Version 2.2.0 release of Microlog captured my attention, when I saw the news posted by the Mobile & Embedded Community. Microlog:

is a small, yet powerful logging library for mobile devices based on the Log4j API. Supports Java ME (J2ME) and Android. Logs to device, to PC or to servers online. Used in all phases from development on emulator/device to outdoor field-testing.

The benefits of Microlog include:

  • Easy to set up
  • Similar to Log4j
  • Small
  • Fast
  • Mature
  • Many different logging destinations: Console, RecordStore, File, Canvas, Form, Bluetooth, ... (many more)
  • Different formatters for different needs

Now, I think I'm in the minority of developers in that a requirement of the software engineering work I do is that the operational system has access to me on a 24/7 basis. I mean, it's a requirement of my job that a text message sent by the operational system can immediately get to me. My Blackberry is within hearing range (almost) constantly. I've even created my own custom messages to send to myself based on certain criteria being met by scripts I've created to troll the data situation.

Why? Because certain messages from the operational system might require an immediate response from me (and others). We're supposed to be up and running 24/7. We have a number of nines of availability that we've contracted to provide. We don't want to fall below the required nines. Our future viability as a data center design, development, and operational management team depends on success in fulfilling the required uptime.

Microlog makes it easy to notify developers or operators that anomalies or potential problems may have emerged. Of course, you can also use it for basic debugging as you develop or update a new application. And it's tuned for JavaME and Android. For that to be the case, it has to be lightweight and fast. It's also mature, having been around since 2005.

If you're working on JavaME or Android code, and you need help with assessing the characteristics of operational code, or code that is intended for an operational environment, Microlog looks to me like something quite worthy of your investigation.

In Java Today, long-time author Jeff Friesen demonstrates some of his recent investigations in Elvis Comes to Java:

In December 2008, Joseph D. Darcy blogged about leading Sun's efforts to develop a set of small language changes for JDK 7. This announcement led Sun to create Project Coin, an official conduit for receiving language enhancement proposalcoin_final_five"> none of these operators made the final cut...

Terrence Barr provides an OREDEV Wrap-Up (& looking forward to next year!):

Just returned from ØREDEV last Friday. Again, a great conference! Not only was it extremely well organized but I also really liked the size of it (800 attendees – not too big, not too small), the location (an old car factory!), the wide range of topics, insightful speakers, real-world focus, and last, but not least, the friendly atmosphere....

The Mobile and Embedded Community announces that Microlog V2 is out:

V2 of Microlog is available for download. Important changes:

  • Hierarchical loggers, so you can have several logger instances.
  • Better and simpler configuration.
  • Smaller and leaner core.
  • A Java GUI for the Bluetooth server.


In today's Weblogs, Fabrizio Giudici says You can read my Hudson configuration:

After the latest upgrade of my Hudson instance, I noticed that a new option in the security matrix appeared: it allows anonymous visitors to have a (read only) look at a job configuration, if the administrator allows it. I think it's a great feature (that I was asking for some months ago), as it allows to share our knowledge about our favourite CI tool. So I've opened most of my jobs and you can poke your nose into them; for instance, (please note that the "/hudson" part could go away in a few days, if the previous link doesn't work try I'll comment about it in a few days, as it implements for the first time a dream that I had months ago, that is the capability of making a release with just a single mouse click...

Binod continues the SailFin discussion with Adding Communication capabilities to JSPs (SailFin CAFE):

Hope you have read my last blog on using SailFin CAFE with web applications. Mohit has added an entry on how to enable Communication capabilities in JSPs. The approach is exactly same except that the CommunicationSession object is available as a session attribute...

Kohsuke Kawaguchi presents his selection for Project of the day: YouDebug:

As a programmer, I spend a lot of time fixing bugs. And a considerable portion of that is the time spent on reproducing a problem. Here is how a typical such session goes. Your user reports that your program doesn't work and throws such and such exception. Or given the symptom he's describing, you suspect some "if" statements to be evaluating to false. If you are lucky and experienced, you can sometimes fix the problem through careful reasoning, but often you need to collect more data to be able to fix the bug. Logging is one such measure, but I often find myself thinking "if only I could ask him to run the program with a debugger and report what the variable 'x' refers to!" After all, a debugger is an ultimate data collection tool. Unlike logging, your program doesn't need to be written a-priori to report data. Similarly, with an ability to inspect stack frames all the way down, evaluate arbitrary expressions, and modify the state of the target problem, a debugger is a far more powerful trouble-shooting tool. The one and the only problem with asking your user to run a debugger is that it's too difficult...

In the Forums, indiika is having a problem with JSP to class file conversion: Hi all, I'm having a small problem. As we know JSP is converted to class file before execute. So I would like to know where this temp class files are created. Specially in Weblogic Server. Lakmal

rahul1kr needs help with JAX-WS custom data type handling: "Hi, I am new to JAX-WS webservice. I have created JAX-WS service which will take custom bean classes as input paramter and return the list of same. Now, I need to write client like DII client(in axis) for WS. The..."

And tspladmin is getting an Intermittent ClassCastException: "I am using Glassfish-v2ur2 on a Windows machine for developing a J2EE web-app. It is being run with the -client option. Sometimes, while re-deploying an application under development, I see a deployment failure with the server log indicating a..."

Our current Spotlight is Geertjan Wielenga's post Financial Applications on the NetBeans Platform: "Experian and Société Générale both have invested in the NetBeans Platform, by using it as the basis of one or more of their applications. And these two are not exactly small organizations. Experian is a global leader in consumer and business credit reporting and marketing services and a constituent of the United Kingdom's FTSE 100 index, with revenues in excess of US$4 billion, while Société Générale is France's second-largest bank by market value. How do I know that these organizations are using the NetBeans Platform? By looking in the mailing list..."

The current Poll asks What do you think about the Java Store's recent progress? The poll will run through Thursday.

Our Feature Articles include Eric Siegelberg's Using a Service Delegate to Avoid MVC Controller Bloat, which describes how to maintain separation of concerns and avoid MVC controller bloat through the use of service delegates. We're also featuring a Java Tech guest column by Marina Kamahele: "Transparent" Panel - Mixing Heavyweight and Lightweight Components.

The latest Java Mobility Podcast is Java Mobile Podcast 90: Augmented Reality: Excerpts from the JavaOne 2009 Augmented Reality session with Kenneth Andersson and Erik Hellman of Sony Ericsson.

Current and upcoming Java Events:

Registered users can submit event listings for the Events Page using our events submission form. All submissions go through an editorial review before being posted to the site.

Archives and Subscriptions: This blog is delivered weekdays as the Java Today RSS feed. Also, once this page is no longer featured as the front page of it will be archived along with other past issues in the Archive.

-- Kevin Farnham

O'Reilly Media

Related Topics >>


Getting Started with Microlog

I you want to get started with Microlog, please read the article "Powerful Logging in Java ME" published here:

Johan Karlsson