Can an Adobe AIR Application run via the command line output to console? - command-line

I have an AIR application that takes command-line arguments via onInvoke. All is good, but I cannot figure out how to print some status messages back to the user (to stdout / console, so to speak). Is it possible?
Even a default log file for traces would be fine, but I can't find any info about it anywhere. Do I need to create my own log file? Now that'd be silly.

Take a look at CommandProxy. It is a low level wrapper around your AIR application that lets you send command from AS3 back to the proxy for communicating with the underlying OS. You should be able to add a means of writing to the command line via such a method.

I don't think that is possible, but I'm not completely sure though.
There is a flashlog.txt file which you can configure so all trace() statements are logged to it. Check this post http://www.digitalflipbook.com/archives/2005/07/trace_from_the.php for more info on how to set it up. This is for logging from the browser, but I'm pretty sure it should also work from an air app.
Additionally, you could use SOS MAX from Powerflasher to log to an external console through an XML socket.

By default, trace() will output to stdout.

Your AIR application is one, big trace window if you want it to be.

Related

how to get asl_log to appear in the iOS system console output?

I'm investigating whether I can get better performance from asl_log than NSLog on iPhone/iOS (probably...) but I'm stuck at a point where it doesn't seem that asl's log output will show up in the System Console (as viewable by a number of apps like System Console, iConsole, etc). I know that I'm setting it up right since I open with ASL_OPT_STDERR, and I see the log entries in XCode when the device is tethered.
I've explored lots of interesting stuff online (e.g. http://boredzo.org/blog/archives/2008-01-20/asl-logging, https://github.com/robbiehanson/CocoaLumberjack) and the best hope seemed to be asl_open() with Facility of "com.apple.console" but alas, the output still doesn't show up in Console. Is NSLog the only option?
Add STDERR to ASL and then it shows up in the console
asl_add_log_file(NULL, STDERR_FILENO);
You need to set read privileges on the message, using either ReadUID or ReadGID. Setting either to -1 will allow any user/group to view the message according to the header file documentation.
aslmsg msg = asl_new(ASL_TYPE_MSG);
asl_set(msg, ASL_KEY_READ_UID, "-1");
asl_log(NULL, msg, ASL_LEVEL_NOTICE, "Hello, world!");
asl_free(msg);

Catalyst equivalent for Rails script console

Is there anything like Ruby on Rails' script console for Perl's Catalyst? From rubyonrails.org:
The console command lets you interact with your Rails application from the command line. On the underside, rails console uses IRB, so if you’ve ever used it, you’ll be right at home. This is useful for testing out quick ideas with code and changing data server-side without touching the website.
I found a blog post talking about implementing it with Devel::REPL, but I cannot get it to work...
No. And, for that matter only a very small percentage of Perl users use opt for the Perl debugger at all -- this is largely because it's faster to execute and throw an exception, and because of the total transparency of Perl Objects -- they're just blessed Hashes and they serialize into strings pretty well.
I happen to like XXX, drop an
use XXX;
XXX \%hash;
or do a Catalyst::Exception->throw( YYY %v );
I've been using CatalystX::REPL with success. I'm not familiar with the RoR console but, basically, CatalystX::REPL will drop you into an interactive environment where you can inspect the application's context object and so on.

printk in driver

I am really new to linux module programming.
I need to some how be able to do some tweak to the ath9k driver in linux.
I finally got the compat wireless source code of ath9k to compile in ubuntu 11.04 and was trying to play around with the code.
I tried using printk to tried to get to see what happen.
First I put printk in the init.c file, the message I printed show up when I use dmesg in the terminal. However, when I tried to use the same printk in another file like rc.c it does not show up at all.
I am wondering why is that?
And is there some other way that I could some how log some information from the code similar to the fprintf. What I need is I need to extract somehow the packet header from the driver.
Thank you
Best Regards.
read about the proc fs, it's a great framework to extract data from device drivers.
once you have registered a device node as proc fs, you can read from it.
once the the read function is called, a callback function you defined is creating the output. this is an excellent way to retrieve data from device.
there are also two other methods, one is sysfs, you can google for it. and the second,
if the the device is a char device, you can implement an ioctrl function which returns the info you need.

Handling errors/exceptions & logging them in iPhone applications

I wanted to know do we need to log the exceptions/errors in a common file in file system when an iPhone application runs for debugging purpose later point in time? Or this is handled by IOS automatically through device logs?
I now using NSLog statements we can print on consol but is there something similar to log4j in Java where you put all debugging statements including errors/exceptions in a single file which you can analyze later point in time.
What is the best way to handle such scenarios.
Some excellent info is found in this previous post on SO:
Logging to a file on the iPhone
Another good tip for logging in general is using the DLog macro:
http://iphoneincubator.com/blog/debugging/the-evolution-of-a-replacement-for-nslog

iPhone SDK: Redirecting stderr/stdout to XCode console

I have a C library that I'm planning to use in an iPhone application. It writes a lot of its debug information to stderr. Is there an easy way to redirect stderr/stdout to my XCode console?
Will I have to write wrappers that call NSLog? If so, what would be the best way of doing so?
I know that stdout at least already goes to the console. I am not 100% sure about stderr.
You can simply do a print, and it will end up in XCode's console.
Edit: Found some references confirming stderr as well.
There’s no need to redirect anything, all the output goes to the console already. Try that:
fprintf(stdout, "Standard output.\n");
fprintf(stderr, "Standard error output.\n");