After the re-factoring it was time to prove my point, that it is possible to execute Microlog on Android. And it did! The setup was simple, it was Microlog with a
ConsoleAppender
and a SimpleFormatter
. Not so very much at the moment, but I think it is a good starting point.During the process I learnt that it was in fact possible to see the
System.out.println()
statements. Many people claim that it is not possible to see the System.out.println()
in the Console. That is true, but it is possible to get hold of the prints. The trick is to show the "LogCat" view. This is activated this way:- Select "Window->Show View->Other..."
- Open up the Android category and select "LogCat"
System.out.println()
and System.err.println()
. A nice side effect is that you now can see your Microlog statements as well!One might ask why should I use Microlog on Android, since there already is a logging API available. This is a perfectly legitimate question. The reason would be that Microlog brings a Log4j like API to the Android platform, but the supplied API is the java.util.logging package. I have always preferred the Log4j API, which was the reason why I choose it for Microlog in the first place. But I guess that you could use Log4j on Android, but Microlog is designed for constrained devices, which Log4j was not.
2 comments:
"One might ask why should I use Microlog on Android"
Let me add another reason to the one that you stated. I think that developers will want to share their code and knowledge between the different Java platforms. If microlog is flexible enough - as you are now making it - then the same code and techniques can be used on for both Android and J2Me.
I agree with you, re-use of knowledge is as important as re-use of code.
The code is only available in the repository and the API will be in flux for a little while, but I hope that you like the final outcome.
Post a Comment