Archive for 2月, 2011

I made a class for syslog output for Adobe AIR.
Because I want to see logs using linux “tail” & “grep” command.

Download:
coltware_airxlib_log_r3.swc on code.google.com
Class name: UDPSyslogTarget.as

How to use UDPSyslogTarget
import com.coltware.airxlib.log.UDPSyslogTarget;

var syslog:UDPSyslogTarget = new UDPSyslogTarget("192.168.1.5");
syslog.facility = UDPSyslogTarget.LOG_LOCAL1;
syslog.program = "AdobeAIR";
syslog.filters = ["com.coltware.*"];
syslog.level = LogEventLevel.DEBUG;
syslog.includeCategory = true;
Log.addTarget(syslog);

Line 3. Set hostname and port(default is 514)
Line 4. Set facility
Line 5. Set program name

Other properties are same as TraceTarget class.

If you don’t know how to use TraceTarget, please see HERE.

output sample
Feb  1 23:46:01 [info] AdobeAIR: com.coltware.airxlib.db.DBManager create if not exists table .... invoked
Feb  1 23:46:02 [info] AdobeAIR: com.coltware.airxlib.db.DBManager TABLE CREATE OK
Feb  1 23:46:02 [debug] AdobeAIR: com.coltware.airxlib.db.DBManager [1/7] [SQL:] CREATE TABLE  IF NOT EXISTS project(
Feb  1 23:46:02 [debug] AdobeAIR: com.coltware.airxlib.db.DBManager [2/7] sysid INTEGER  PRIMARY KEY AUTOINCREMENT ,
Feb  1 23:46:02 [debug] AdobeAIR: com.coltware.airxlib.db.DBManager [3/7] title TEXT  NOT NULL ,
Feb  1 23:46:02 [debug] AdobeAIR: com.coltware.airxlib.db.DBManager [4/7] createdAt DATE  NOT NULL ,
Feb  1 23:46:02 [debug] AdobeAIR: com.coltware.airxlib.db.DBManager [5/7] updatedAt DATE  NOT NULL ,
Feb  1 23:46:02 [debug] AdobeAIR: com.coltware.airxlib.db.DBManager [6/7] createdBy INTEGER ,
Feb  1 23:46:02 [debug] AdobeAIR: com.coltware.airxlib.db.DBManager [7/7] updatedBy INTEGER );
rsyslog conf(sample)
$template air,"%timegenerated% [%syslogseverity-text%] %programname%: %msg%"
local1.*                                                /var/log/air.log;air
RSS
Add to Google
2011年2月
« 1月   4月 »
 12345
6789101112
13141516171819
20212223242526
2728