Some PLC's have diagnostic buffers or power down/ stop routines (these detect a power loss or stop instances) and can either write error codes to a buffer or even run a short bit of code before shutting down, not sure about ML though.
No, the Logix500 series only have a battery for memory retention, it cannot supply enough power for the CPU to keep working, even for a few hundred clock cycles.