In the log I see things like:

    2017-09-13 03:54:33 init message: Rescanning...
    2017-09-13 03:54:33 Rescanning last 68616 blocks (from block 416339)...
    2017-09-13 03:54:40 AddToWallet xxxxx  update
    2017-09-13 03:55:33 Still rescanning. At block 418849. Progress=0.549138

I would be interested to see the wallet file name on each of these log lines.

Would there be any interest in merging such a PR?
} else {
            
            if (pubKeys.size() && keys.size() == 0) {
                const std::string& strPubKey = pubKeys[0].get_str();
                if (!IsHex(strPubKey)) {
                    throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Pubkey must be a hex string");
                }
                std::vector<unsigned char> vData(ParseHex(strPubKey));
                CPubKey pubKey(vData.begin(), vData.end());
                if (!pubKey.IsFullyValid()) {
                    throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Pubkey is not a valid public key");
                }
                CTxDestination pubkey_dest = pubKey.GetID();
                
                if (!isScript && !(pubkey_dest == dest)) {
                    throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Consistency check failed");
                }
                
                if (isScript) {
                    CTxDestination destination;
                    if (ExtractDestination(script, destination)) {
                        if (!(destination == pubkey_dest)) {
                            throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Consistency check failed");
                        }
                    }
                }
                CScript pubKeyScript = GetScriptForDestination(pubkey_dest);
                if (::IsMine(*pwallet, pubKeyScript) == ISMINE_SPENDABLE) {
                    throw JSONRPCError(RPC_WALLET_ERROR, "The wallet already contains the private key for this address or script");
                }