That's quite easy. Launch Logic, create a new, empty project and add an External MIDI track. Check the box for using the external instrument plug-in, since this makes recording into Logic a bit easier. If you use USB MIDI, use the P5/P10 as destination.
Don't forget to switch of local control on your P5, if you want to use the P5 keyboard as your MIDI input device (aka. master keyboard). It's one of the global parameters.
Now, you're all set. If you need to play parts, that are far too complicated, reduce the tempo in Logic or program them in the piano roll.
Best,
Steffan