« Sneak Peek: Fan 4.2 | Main | Fan 4.2.1 Launched : Save videos to watch later »

Say Hello to LogBook

Most Flex developers write perfect code ;). However, every once in a while, a bug appears somewhere in your application that becomes notoriously hard to find. Worse when the bug actually appears on a live web application and you have very poor visibility into whats happening within your application. In such cases, logging application events can be a blessing. As Flex developers may know, Flex has a pretty robust logging framework. However the default logging target is just the trace window and lacking in functionality most developers need. We hope this tool can improve that.

Logbook is a tool that we developed within Comcast Interactive Media for logging messages from our Flex applications. LogBook is a desktop application built using Adobe AIR, so works on both Macs and PCs. This is the first public build of it and we have a list of features we are hoping to add in the coming months. LogBook is released under the MIT Open Source License.

Picture%2010.png


How does it work
The LogBook application listens on a LocalConnection to messages sent from any application. When you launch LogBook, it will prompt you to enter the name of the connection you want to listen to. On the other end, in your Flex application, you must use the LocalConnectionTarget object in the cim.fx.logging.targets package as a logging target. And thats pretty much it. Now all logs will get sent to the LogBook application.

Features
There are quite a number of interesting features in LogBook that make it really useful:

Color coded alerts
LogMessages in the LogBook are color coded from gray for simple debug messages to red indicating fatal messages. This makes them really easy to spot when looking through a large set of log messages.

Level based filtering
The drop down ComboBox quickly lets you select what level you are interested in. For example, when debugging an application if you only care to see warning, error and fatal messages, you can set your level to "Warn" and all messages below that threshold will not be visible.

Logger based filtering
In a typical Flex application you can create a variety of Loggers by calling the Log.getLogger('...') method (see http://livedocs.adobe.com/labs/flex3/langref/mx/logging/Log.html#getLogger()). Each Logger created gets listed in the list on the right hand side of LogBook. By clicking on any logger listed there, you can filter data among the different Loggers that are logging messages letting you isolate messages from classes you are debugging from the larger log files. The list supports multiple selections.

Live Search
Using the text-input at the top of the application lets you filter on text in messages within your logs to quickly find info you are looking for.

Save to file
You can even save the logs into a text file on your machine. Log files are saved as formatted text that is very readable using any text editor.

Text view vs. Grid view
While most of the time, the grid view works to view log messages, you can even switch to text view if for example you want to copy paste a certain part of the log message. Once again, the text view is cleanly formatted to be readable.

Open source
The LogBook is released under the open source MIT license which means you are welcome to take the source code and build on top of it if you wish. However, we encourage you to submit feature requests and code that we can integrate into the core LogBook application so that evolution of this application benefits the entire Flex developer community.
All code is housed on the Google Code site and bugs and feature requests will be listed there as well.

Download LogBook
Download the LocalConnection based Logging class here. To use this, see the "Using LogBook" section of this post.

Using LogBook

Once you have installed LogBook, launch it and you will be prompted to enter the name of the localConnection you want it to listen to. The example below broadcasts messages out on a channel named _test. Enter _test in the text input. Now in the widget below, put any message in the text input, choose the level you want to send the message as and hit send. In your application, you will immediately see the message appear in the main view. Add a few more messages and play around with the filtering functions in LogBook.

The source code for the widget below can be downloaded from here.

To enable LogBook logging in your application, all you have to do is include the cim.fx.logging.targets.LocalConnectionTarget in your classpath and create a new LocalConnectionTarget object initializing it with the name of your communication channel. Once thats set as your Logger, you should be good to go.
You can use the source code of this widget as a starting point to get into LogBook.

Comments (11)

Glad to see more people using the power of the Flex logging framework. Nice work.

A Mitchell:

The link for the source code for the widget is not enabled.

Excellent application. Took a mere 5 minutes to sandwich the LocalConnection call into my existing logging framework. :D My only gripe so far, however, is once I've selected an item in the "Loggers" List, I don't seem to be able to revert to view all loggers. Is there something simple I'm missing?

Congrats again on the excellent release.

Cheers,

A.

@A Mitchell,
Sorry about that, Its enabled now.

@Andrew,
Yeah thats a known bug. Its number one on our list so far ;). http://code.google.com/p/cimlogbook/issues/detail?id=1#makechanges.
Right now the only workaround is to do a Control+A to select all values in the list.

Whoops. I didn't realize there was an issue tracker set up. Just a heads up, it seems that Control+A ( or any other combination of modifier keys ) doesn't work on a mac, but you can just shift+click to select multiples.

Thanks for the response.

Cheers,

A.

Overall I like it, really neat and tidy to use and will be able to just slip it into our existing logging framework.

My only worry in using it on a day to day basis is the choice of background colours for the different levels are all look very similar to me (I'm colour blind you see). It would be really nice if they were user configurable or a simple icon column was included. (I'll put this as a feature request on the Google code site)

But that is just a minor issue. I have looked at other loggers including another Air version (by Renaun Erickson) and have so far decided to live with the trace output - but I think I'll be making the switch to this.

Walter Steve Pollard Jr.:

I ran into the:

"This application requires a version of the Adobe Integrated Runtime (AIR) which is no longer supported. Please contact the application author for an updated version"

and after updating my version of AIR, everything was smooth.

I'm really looking forward to getting this into the logging framework I'm putting together. I'm a Flash developer and excuse my lack of flex knowledge but... can I just open a local connection and pass the correct parameters to send to logbook?

Thanks...

We are working on a pure AS3 class for connecting to LogBook as well, so you may want to use that, but if its something you need immediately, as long as you can broadcast something like this:


lc.send(connection, LOGGING_METHOD, date, category, level, message);

you should be good.

Maz:

Hi and first thanks for this very useful app. I am using it now to monitor all my applications (flex & air).

Couple suggestions :
- have a way to monitor multiple LocalConnections in different tabs, at the same time
- at logbook relaunch, restore last session settings (LocalConenction name)

Thanks !!

{Maz}

@Maz,

Both are requested features and will be included in time. If you want to promote these as requirements, please join the conversations at the cimlogbook google-group (http://http://groups.google.com/group/cimlogbook). The more people that request a feature, the more likely it will be included in a build soon :)

Great desktop application. I will use this one in my office.

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

About

This page contains a single entry from the blog posted on February 8, 2008 4:46 PM.

The previous post in this blog was Sneak Peek: Fan 4.2.

The next post in this blog is Fan 4.2.1 Launched : Save videos to watch later.

Many more can be found on the main index page or by looking through the archives.

Powered by
Movable Type 3.35