Use a server-side scripting language. Create this PHP script:
fwrite($handle,"1 guest from IP".$_SERVER['REMOTE_ADDR']."arrived at ".time()."\n");
header("HTTP/1.1 301 Moved Permanently",true);
<p>Document moved <a href="<?php echo $url; ?>">here</a></p>
Save this as index.php and upload it to document root of domainA. Also, use mod_rewrite to redirect all requests on domainA to the script like so:
RewriteRule ^(.*)$ /index.php [L]
You may have to add a check for the redirect status environment variable right after "RewriteEngine On" just incase the above lines go in an endless loop and/or you get error 500 (internal server error). An alternative is to upload the script to all folders on domainA. To customize the log, change the fwrite line. I apologize for poor grammar in the text part of the code, but you'll understand how the code works when you try it.