AIR Application Syslog with SQLite

In AIR (Flex/Flash) application, syslog support might be very useful for QA/developers also can be helpful for end user as well. I wrote some fast code for my personal project Dailytasks on this (and another more complex SQLite database with transaction manager) during this long weekend.

You can download source code from here. (Need some tweaks to fit your own application for sure.)

Here’s how it works:

  • (Run once and comment it out) Create syslog database file and table. (I use some code to create and run once only, when I need update my table structure, rebuild database again.)
  • Initialize SyslogService instance in preinitialize process of application. (it will open SQLConnection and compile statement to be used later.)
  • Call static function from any points, i.e.:
    • SyslogService.log(SyslogLevel.INFO, 'Application start.');
  • If statement is executing, push log data into stack and insert after.

Update (September 3):

I don’t have time to test completely. If you got database open error, just add open listener before execute the statement. Code is just simple like this.

if(!sqlConnection.connected)

sqlConneciton.addEventListener ...

Because the connection and statement will be reused all the time, you need to detect only once.

Leave a comment

Name: (Required)

eMail: (Required)

Website:

Comment: