When logged in, type
/demorecord <filename>
into your command line. It will start demorecording. The demorecord file will go into a directory named "client demos" under your City of Heroes directory.
The demorecord will last until you either change zones or type
/demostop
Note that opening a mission door counts as changing zones, but going into an elevator in a mission does not. You can check by looking at your "client demos" directory- the file should appear, at zero length, as soon as you start the record, and will acquire a size when it stops recording.
You can play it back by making a shortcut out of the game client and editing the target line...and I can't remember what to edit it as, not at home. Anyone?