How do I turn on 'shutdown logging' or operating system tracing?-Collection of common programming errors

I have a simple question: how do I turn on logging of the shutdown sequence and X-server, which both keep failing; shutdown that doesn’t shut it down, XServer that crashes.

I would like to create the equivalent of a windows memory dump, the windows event viewer’s System-bucket and a crash-dump on SIGTERM for XServer.

Regards