views:

1789

answers:

5

Hi there, quick question, I've been looking for a simple logging tool for AS3 projects (I do not want any Flex dependencies) and my impression so far has been that there is no actively developed project.

What I need is basic logging, and adapters to allow me to send logging to file (using AIR and a LocalConnection maybe) and maybe send to html div etc.

Anyone have any opinions on a simple, light weight project?

+1  A: 

We have recently started a project called AS3Commons that contains an early implementation of an AS3 Logging framework. We're aiming to provide a Logging abstraction API that allows you to plug in adapters for other logging frameworks. We also have a built-in logger that logs using trace.

It's usage is similar to other logging frameworks.

private static var logger:ILogger = LoggerFactory.getLogger("com.domain.Class");

Check it at http://code.google.com/p/as3-commons/

Any feedback is appreciated.

Christophe Herreman
Thanks Christophe, I'm already using your reflection API, and I'm quite happy with that. I'll give the commons a look ;)
Brian Heylin
Good to hear that. We are actually moving the AS3Reflect project to AS3Commons Reflect. It's already in the repository.
Christophe Herreman
Ah ok good stuff, just about to check out the repo. I'll see if I can contribute anything to the project.
Brian Heylin
Seems to be some trouble with the maven build. Trouble with flex-mojos download, I'll try a build again later.
Brian Heylin
Bummer. You can get a snapshot from http://dev.yoolab.org/maven/repo/snapshots/org/as3commons/
Christophe Herreman
Thanks ;), I'll try the maven build later, seems like the flex-mojos URL is invalid right now http://repo1.maven.org/maven2/info/flex-mojos/flex-compiler-mojo/2.0.1/flex-compiler-mojo-2.0.1.pom.Looks like it has actually been removed from the info folder.
Brian Heylin
A: 

I'm always surprised at the number of people who haven't heard of Arthropod. It does everything you described and more. Including password encrypted connections. Arthropod is also set up in a way that it is very easy to make quick edits to the class for your specific needs.

Jonathan Dumaine
+1  A: 

There is a standard Logging API in AS3. You can set it up to log to different targets. For instance, if you're using AIR, you could get it to log to a file using the FileTarget in as3corelib.

Setting up:

var logFile:File = File.applicationStorageDirectory.resolvePath("logs/logfile.log");
var logTarget:FileTarget = new FileTarget(logFile);
logTarget.filters = ["path.to.Class"];
logTarget.level = LogEventLevel.ALL;
logTarget.includeDate = true;
logTarget.includeTime = true;
logTarget.includeCategory = true;
logTarget.includeLevel = true;
Log.addTarget(logTarget);

Logging:

var log:ILogger = Log.getLogger("path.to.Class");
log.info("testing the logging...");
Rhys Causey
Thanks Rhy but the ILogger interface and Log class are defined within the framework.swc, which is the Flex framework. I'm looking for a logging solution without having to depends on Flex. The mojority of my projects to not need Flex.
Brian Heylin
I didn't know that -- thanks for the info.
Rhys Causey
A: 

I've got a Flash-friendly logging project going. It's nothing big (yet?) but it's light and handy. It does (optionally) take advantage of Arthropod (a great project) but you can pretty easily shoot the output anywhere you like. It works similarly to the Flex framework so if you are familiar with that then the transition would be painless.

You can read about the project and download the goods here.

Jason Crist
+1  A: 

This is the best as3 logger by far!!!!

http://arthropod.stopp.se/