Possible to capture ActionScript logs in game?

I’m wondering whether it’s possible to capture logs from my hud (scaleform) while running the game.

My hud has become a very large application by itself, and occasionally it will run into bugs. However it simply fails silently (often recovering fine). But I’d love to view the error logs to see what runtime errors are occurring.

Anyone know if this is possible?

Did you try this yet? UDK | ScaleformTechnicalGuide

If that doesn’t help I’m afraid you’ll have to do some research and roll a custom solution yourself. One idea could be to catch any errors/exceptions occurring (ideally prevent them from happening at all in the first place) and send the message string to an unreal function and do the logging from there.

Actually that’d be great, ill take a look into it

I realize I’m a little bit late to the party here, but here are some of the things I’ve done:

In my PlayerController class, I make a function similar to this. (Not at my dev machine at the moment.)



function Log(string LogMessage)
{
    `log(LogMessage);
}


Then in virtually all of my classes, whenever I want to log something, I do a



foo()
{
    local MyPlayerController PC;
    PC = MyPlayerController(GetALocalPlayerController());
    PC.Log(self $ ".foo():  Something happened here.");
}


I make all of my menus extend a GFxMoviePlayer class, and I put a log function in there that calls the PC’s log function. From ActionScript I do a



ExternalInterface.call("Log", "Some log message.");


That talks to a function like this in the GFxMoviePlayer class:



function Log(string LogMessage)
{
    MyPlayerController(GetPC()).Log(self $ ": " $ LogMessage);
}


I have something similar @Nathaniel3W.

But it’s runtime errors I’m after (like trying to run a method on a null object).

You’'ll have to use dummy data for menu and test it in Flash itself using scaleform launcher

Yeah that’s what I’ve been doing so far. However my hud (flash) application is so huge now, with so many variables an interactions with UnrealScript, that I’m sure there are runtime errors occurring during gameplay that are not caught in the isolated testing with the dummy data. It would just be so nice if I had errors being written to log files at runtime (in engine).

If the last paragraph at UDK | ScaleformTechnicalGuide didn’t help, then you’ll have to manually log errors.

In ActionScript you can set up your own exception handling: Adobe Flash Platform * Handling synchronous errors in an application. You might be able to use your existing log functionality with this Pokemon exception handler…



try
{
    // All your code goes here
}
catch (error:*) 
{ 
    throw MyError; // Catch any other error.
    // And call your log function.
} 


…to “catch 'em all.” You wrap a try statement around all the code in every function, then put a catch right below it that write the name of the function to your log. It won’t be very specific or helpful at first, but if you at least log the name of the function causing the error, then it will let you know where to look and when.

I’ve been using the in-built logging by adding Suppress=DevGFxUI to my config files.

It’s great for seeing when errors are occurring, but not where they’re occurring.

All I see in the logs is:



DevGFxUI: TypeError: Error #1009


I would love it if there was some way of logging the filename and line-number. It is a real pain to actually trace down where exactly the errors are occurring.

If anyone knows of a way, I’d love to hear it.