Assuming you are flying in an FAA "controlled" area, you "must document and record the following time [...] : (1) Training and aeronautical experience used to meet the requirements for a certificate, rating, or flight review of this part." (FAR §61.51(a)).
Now this is for you, but your instructor should have a look at FAR §61.189(a), where it says: "A flight instructor must sign the logbook of each person to whom that instructor has given flight training or ground training".
So, you don't have to log the time, if you don't want it to count to your training, but your instructor is required to sign your logbook if he gives you any flight training.
For every day life I would say this should be interpreted as:
Yes you have to log your flight time when you train for a license!