Replications fails with a vague message: "The last step to run was step 3: Detect nonlogged agent shutdown"
I found the SQL job (under SQL Server Agent, Jobs folder at the left pane of SQL Server Management Studio) associated to Distribution Agent which is in charge of running Synchronization job. I edited the 2nd step of the job i.e. Run agent step (available in the Job Properties dialog that appears by double clicking the job or by right click on the job and selecting Properties).

In the Job Step Properties dialog, I added two parameters to get more log messages:
-OutputVerboseLevel 2 -Output F:\log_dir\snapshotagent.log 


I re-run the Synchronization job and after seeing the error, the details were available in F:\log_dir\snapshotagent.log. I hope it is useful for you.