The Leonardo and Mega use different hardware SPI pins which make them incompatible with the SD library when using the Datalogger shield.