It depends on your web server. Let's assume you're using IIS for the sake of
it:
There's a few ways you could do it - you could just import the server logs
into an access database, and find the 404s from that, or you could change the
404 page to a URL on the server so that it inserts data into the db when the
page is opened