Jan 17, 2009

The Microlog Modules

The Microlog project started out its life as a small set of classes. Since then Microlog has grown and transformed into several modules. The reason is of course to make it easier for the developers using Microlog and to keep the core small. The downside is that a new user of Microlog might get confused. If you feel that you fall into that category, please read on. For those of you that already are hooked on Microlog, I hope that this will give you the overview that you been longing for.

The Microlog project consists of these modules:
  • Microlog Java ME library
  • Microlog Instrument
  • Microlog Instrumentor Example
  • Microlog Java ME library Examples
  • Microlog Servers
The Microlog Java ME library is where all the goodies are. Here you will find the logging classes. If you choose to only download one module, this should be the one. The Microlog ME library examples module contains example MIDlets that demonstrate how to use and setup Microlog.

Some users complained about the inability to log the name of the method and the line number where the actual logging took place. The reason for this is that Java ME with the CLDC configuration does not support reflection. Our workaround is to instrument the bytecode before you create your JAR file. The Microlog Instrument module contains a tool for inserting the relevant information. If you wonder how to use it, you could download the Microlog Instrumentor Example module. If you are content with only logging the name of the class, you could use the Logger.getLogger(Class clazz) method to create your Logger instance. This way you get a named logger that has the same name as your class, that is the fully qualified classname. This could be used in conjunction with the Microlog instrumentor, since they are not mutually exclusive. It should be noted that the size of the classes grows when instrumenting them. It is a matter of taste and need that decides when to instrument your classes. One solution could be that you instrument your classes during development, but skip the instrumentation when creating the final jar. This adheres to the Microlog philosophy, we bring you the tools and you select the parts you like.

Last but not least, there is the Microlog Servers module. This contains example code of several servers. I prefer to write examples since the servers are rather simple, although I believe that they are just enough for most people. The output is printed to the standard output. If you start the server from the command line, the output is shown in the command shell. Today there are two servers available; the Bluetooth server and the socket server. The socket server could be used for normal sockets, as well as SSL sockets. Both are intended to be executed on a PC. If you need to execute a Bluetooth server on a phone, there is also a MIDlet version available in the Microlog Java ME library module.

I hope that this guide gave you a good insight into Microlog. Feedback is very welcome.