i wasn't sure where to put this thread so please redirect me if im in the wrong forum.

i have a batch file that uploads a data.sql script to a mysql server and its working fine, i have this command:

Code:
mysql -u [username] -p[pass] -h [host] [db_name] < data.sql
this works fine but i want add the ability to write to a log whenever this batch file executes successfully or if there is an error

basically i want to be able to do something like this:

Code:
mysql -u [username] -p[pass] -h [host] [db_name] < data.sql

*sudocode*
if mysql command ok
   echo "command executed successfully >> log.txt
else if mysql command returned error
   echo "there was an error the command did not executed" >> log txt
so my question boils down to, am I taking the right approach? and if so how can i read or interpret the responses from the shell within a batch file? is that possible or should I consider more powerful languages for this type of scripts like c++ or java?

thanks.