Sep 26, 2010

Microlog4Android V1.0 Released

Finally! After many months of struggling with Microlog4Android, the first official release is here. The core is the original Microlog code, but it is re-written to take full use Java SE features. For example, no Vectors are used. This means that the logging is faster than it was in Java ME. One important addition is the support for SLF4J. This should make it easy to migrate if necessary. This might also be an addition to future versions of Microlog. This way it should be easy to share code between Java ME and Android. The most important appenders are there as well.

Please download it from here. As always, any feedback and comments are welcome.

10 comments:

Jarle Hansen said...

A very quick comment about the slf4j support. Like logback we have native slf4j support. This means we package the slf4j classes inside the project so you do not need to download 2 separate jar-files to use the logging facade. Simply use the m4a-jar file and you will have the entire slf4j API available.

Valentino said...

Dear Johan and dear Jarle,

First of all, thank you for providing the Microlog4Android library. I appreciate your work.

I'm using th class FileAppender.

As I tried to clear the log-file, I got this Exception:
ERROR/AndroidRuntime(6984): Caused by: java.lang.UnsupportedOperationException
ERROR/AndroidRuntime(6984): at com.google.code.microlog4android.appender.FileAppender.clear(FileAppender.java:76)

With the "UnsupportedOperationException" are you basically saying me "implement the clearing on your own"?

My Open Source Software Development Blog said...

If I remember correctly, we did this by purpose. We did not want people to accidentally clear their logs.

But of course this is something that we might re-consider. It is easier to make the right decisions when we get feedback like yours.

Bo Minh Khue said...

Hi

Could you give us a quick guide how to use microlog4android?
I'm newbie android. I want to use this logs on my project but I don't know how to integrate it my project.

Thank you.

My Open Source Software Development Blog said...

Hi Dang,

it is pretty simple:

1. Download the Microlog4Android jar and the microlog.properties file
2. Add the jar to the classpath of your project.
3. Add the microlog.properties as a resource.
4. Make a call to PropertyConfigurator.configure() in your main Activity class.
5. Create a static Logger instance by calling Logger.getLogger();
6. Use your logger variable, for example logger.debug();

Anonymous said...

Hi

Good job on library - it's exactly what I need.

I have tried using %d to output the datetime but for the FileAppender it looks as if it's written as GMT. Is there something I should be doing to get the local time?

Thanks

Rob

My Open Source Software Development Blog said...

Please check your locale settings on your phone. Otherwise I have to take a look at the code, but as far as I remember the time should be outputted according to the current timezone.

Anonymous said...

Hi Jarle,

thanks for providing the Microlog4Android library. I've been using Log4J forever, and was really disappointed with the level of configuration available with logcat. This package fills the gap.

I've made some improvements to the source, and I'd like to contribute them back to the project:
1. Full Log4J style property configuration support.
2. Appender and Formatter properties can be set from the property file.
3. Appenders can be attached to loggers at any level in the hierarchy.

1 & 2 are based on the code from the corresponding MicroLog 1.6 class.

Please contact me (avanha at photobucket.com). I can either push to the repository, or share my clone for you to pull from.

Mihai said...

There is a possibility to set different log levels for packages?

I tried something like this
microlog.level=INFO
microlog.logger.com.psx.display=DEBUG
but I didn't obtain the debug level for that package..
Thank you

Anonymous said...

purchase flower girl dresses

shop graduation dresses