Log in

View Full Version : Automated error reporting (like in WinXP)


Punchey
06-30-2003, 04:09 AM
I saw it suggested here earlier (I think in reference to Alien Flux) that if your game crashes, you could have a flag set in the registry that would reveal this and then the next time your app starts, you prompt the user to submit an error report (ala WinXP).

So my question is, what's the easiest and/or best way to accomplish this? I have a log file in my case that is a simple text file that I'd like to simply upload to my website.

I thought about just using an HTML input type of "file" and then generating an HTML file and setting the "value" parameter to the path of the log file. But I've read that most browsers ignore the "value" parameter for security reasons. The easiest solution I can come up with in this vein is to put the text of the path to the file in the HTML document and then have the user copy and paste this text into the "file" text box. But even though this is quite simple, it's probably too much to ask of the user as most people would likely "bug out" if it looked like they had to do any "work" to submit the error report.

Ideally, I'd like to be able to simply pop up a MessageBox that says something like, "There was an error last time you ran X, would you like to submit an error report?" [YES][NO]. And if they click "Yes", that's the last thing the user has to do.

Any thoughts?

princec
06-30-2003, 05:29 AM
That's exactly how I'm going to do it; it'll be the first thing that the app does before it even attempts to fiddle with monitor resolutions etc.

I'll be doing an HTTP POST to send the data so it'll get through firewalls.

Cas :)

Punchey
06-30-2003, 05:35 AM
How are you going to do it? Copy-paste? value=...(which isn't supposed to be reliable since most browsers ignore this parameter for security reasons)?

Hmmm... I just had another thought. If I don't want to actually upload a file per-se, I could just generate an HTML document with FORM code and a text box filled with the contents of the log file. Then just submit that and store it in a MySQL table.

I wonder, though... is there a way this HTML could be submitted without the user having to click "Submit" on the HTML form? Like a way to invoke the POST method as soon as the HTML page is loaded?

princec
06-30-2003, 06:02 AM
I had no plans at all of involving a browser anywhere in the equation. I was simply going to open an HttpURLConnection to my server, stuff the data down the socket as a POST command, and that's it.

Cas :)

Punchey
06-30-2003, 06:04 AM
Hmmmm... I'd thought of doing that myself, but I don't have much experience with netcode and didn't know how to send HTTP data as a POST method. Would you mind sharing some code? :)

princec
06-30-2003, 06:33 AM
It's all hidden behind the scenes in Java :)
But it's really very trivial: open a socket to the host on port 80, and write the HTTP headers for a POST to it (don't know it off hand but it's something really simple and easily Googled) and then write your data. Close socket, done.

Cas :)

Punchey
06-30-2003, 06:35 AM
Okay, thanks. I'll go a Googling! :) I wasn't aware that this is all a POST method is.

milo
06-30-2003, 07:22 AM
If you want to know how HTTP works, go to the source -
ftp://ftp.isi.edu/in-notes/rfc2616.txt

HTTP is a wonderfully simple and easy-to-work-with protocol. I ended up writing a basic web server and web client for my game in C++ in a few days. That is, the basics are very simple and easy to write. Creating an industrial strength web server or browser is another matter.

Punchey
06-30-2003, 08:03 AM
Thanks, milo! I'll check it out.

Your project is looking slick, BTW.

bstone
06-30-2003, 09:20 AM
You could find it easier to use MAPI, but you should investigate its availability on older systems.

Punchey
06-30-2003, 09:42 AM
Thanks, bstone! Apparently, MAPI has been supported on PCs since WFW (Windows For Workgroups) 3.1. So not much problem there. But from what I can tell, it'd require the setting up of a mail host etc.. If this is the case, I think I'll stick with just using sockets... but I'll DEFINITELY have to keep MAPI in mind for a PBEM game I have in mind! Thanks, again.

Zoggles
06-30-2003, 10:34 AM
"There was an error last time you ran X, would you like to submit an error report?" [YES][NO]. And if they click "Yes", that's the last thing the user has to do.

Can I recommend that you have a third option there, to view the data that the game wants to send.

I personally would never click the 'Yes' unless I knew exactly what was being sent.

-Z-

Punchey
06-30-2003, 10:36 AM
Good idea. Thanks!