logging4bb – a Logging Framework for BlackBerry OS

[Ekke is an independent software developer and a BlackBerry fan. He recently open-sourced logging4bb and graciously accepted my invitation to write a post on the framework – Eduardo]


I’ve been a big fan of logging for many years, and this was one of the main things I missed in BlackBerry OS.  Debugging on mobile devices sometimes is a challenge – for instance, testing Location-based Services out in the field or applications with many async tasks, where debugging changes the behaviour of the application – and logging is an invaluable aid.

During these last two years I have developed a logging framework and now you can get it as Open Source.


logging4bb is a background app and will be started automatically as a system module.
logging4bb logs events to a remote socket logger (Lilith) and/or to a local SQLite database.

My goal for logging4bb was to have an easy to use logging framework for BBOS.  The general structure is as follows:

logging4bb registers some remote commands using BlackBerry OS Command Framework. This means that the logger is not hard bundled with other Applications and can serve as many APPs as you like.

To use logging4bb you only need to copy 5 classes into your application…

… change same parameters in the LoggerFactory class (marked as TODO) and it works.

The logging from BlackBerry OS Applications works similar to Logging in Java SE, each class gets a logger:

// the logger
 private static final ILogger logger =

and you can log as usual:

logger.debug("HelloLoggerScreen successfully initialized");

If the background app isn’t installed on the BlackBerry there’s a fallback to sys-out logging. So it is possible to install the logger only if you need it or while testing.

For additional details, please take a look at my presentation at BlackBerry DevCon 2011 in San Francisco:

or download the pdf: Logging: Esay and Flexible

OSS as GIT repository at Bitbucket

logging4bb is hosted at Bitbucket.  Why? because Bitbucket offers Unlimited Private Repositories for free.

There are two projects: logging4bb, and a “Hello Logging” example that shows how to use the framework.


logging4bb uses Git branches to manage different platforms in one single repository.  The default master branch only has a readme file, while the other two branches have the code that is needed for each platform – please checkout the branch you need:

  • dev-public is always the newest one – at the moment BB OS 7
  • os6/dev-public is based on BB OS 6

Please take a look at this blog I wrote about Git and mobile development describing the structure of my GIT repositories to understand how it works.

BIS Connection

logging4bb isn’t running out of the box because BIS is used to communicate with the logging server and you have to replace the secret connection string.

If you don’t want to use BIS,  you can set deviceside=true to use a direct socket connection, customize the transport protocol, and do it your way.

BlackBerry Forums will help if you have questions about BlackBerry Connections.


logging4bb uses the Eclipse Public License (EPL). EPL gives the licensor much freedom and can be combined easy with Apache Licenses used by BlackBerry OSS projects at Github.

All documentation and content is licensed under Creative Commons License 3.0 (BY-NC-SA).

Lilith is dual-licensed for Apache 2.0, LGPL and GPL – so its always compatible.

HowTo start

There are two ways to get the sources:

  1. Use Eclipse and download the ready-to-use Eclipse Projects, or
  2. Clone from GIT Repositories

Once all is installed and running you will be able to log to Lilith or SQLite on the device.

Logging to Server (Lilith Logmonitor)

Please download Lilith from Sourceforge.

Lilith is available as APP for OSX and also for Windows and Linux.

Originally Lilith was used as a LogMonitor for SLF4J / LogBack but, as you probably know, LogBack doesn’t run on BlackBerry OS.  Instead logging4bb uses a trick and sends Log Messages in the same format to Lilith as this would be done using an Appender for Lilith from Java SE applications.

This is really great if you’re testing Client / Server applications – you can monitor the Logging using Lilith and watch server-logs side-by-side with logs from BlackBerry devices or Simulator.

Logging to DB (local SQLite)

logging4bb uses a local SQLite database for two use-cases:

  • Storing preferences
  • Storing log messages

The first time logging4bb is started, the SQLite will be created automatically and the preferences will be initialized.

Here’s an example with some log events stored into SQLite (opened with Firefox PlugIn SQLite Manager):

Problems ? Questions ? More Info ?

logging4bb requires BlackBerry OS 6+ and needs a SDCard.  Documentation for the framework can be found here.

If you encounter bugs or want to request new features, please open an issue at Bitbucket here.


Thanks that I was allowed to present logging4bb as part of the OpenBBNews. I will publish additional Open Source Projects in the next months.

I work as an Independent Software Architect in Germany and I blog about my work at ekkes-corner.  You can follow me at @ekkescorner.


About ekkescorner

ekke (Ekkehard Gentz): International Development native Mobile Business Apps BlackBerry 10 | Qt Mobile (Android, iOS) workshops, trainings, bootcamps and consulting. BlackBerry Elite Developer BlackBerry Platin Enterprise Partner ekke works as Independent Softwarearchitect in the domain of business applications (ERP) since more then 30 years. He likes to develop high quality mobile apps for customers around the world. ekke is speaker on national and international developer conferences, writes articles, blogs at http://ekkes-corner.org and tweets @ekkescorner. more infos on native mobile app development: http://appbus.org ekke lives in the south of Germany and in his spare time he likes to travel with family as backpacker to greek islands.
This entry was posted in Java and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s