datalogger for counter sensor with RTC HELP!

This part:

logFile.print("LogFile cannot be opened");

Doesn't look like it will work--if the log file can't be opened, how are you going to print the error message to the log file?