Do the captain and first officer log the same hours for a flight?
Both log time, they just log it as different things. This is similar as a student and instructor logging time, but for different roles. The captain is the pilot-in-command and thus logs 'PIC', the F/O is second-in-command and logs 'SIC'.

The pilot who is tasked with controlling the plane is called 'PF' or "pilot flying", and the other is called 'PNF' or "pilot not flying", or "pilot monitoring". This doesn't affect who's PIC and who's SIC though, and if I understand correctly, it's not generally logged who's actually flying.