## Not fully satisfying

I had a similar need on a Debian 7.8 and observe that basically there's no clear and explicit message in log, which is a little surprising.

Grep through `/var/log` would tell the time the machine was shut down, show proper daemons shutdown, etc, but not the initial reason.

 shutdown[25861]: shutting down for system halt

The other solutions mentioned (`last -x`) did not help much.

## Looking how it works

Reading `/etc/acpi/powerbtn-acpi-support.sh` which includes:

<pre>
if [ -x /etc/acpi/powerbtn.sh ] ; then
	# Compatibility with old config script from acpid package
	/etc/acpi/powerbtn.sh
elif [ -x /etc/acpi/powerbtn.sh.dpkg-bak ] ; then
 # Compatibility with old config script from acpid package
	# which is still around because it was changed by the admin
 /etc/acpi/powerbtn.sh.dpkg-bak
else
	# Normal handling.
	/sbin/shutdown -h -P now "Power button pressed"
fi
</pre>

Notice that an explicit text is given as parameter of the `shutdown` command. I would expect that string to be logged automatically by the shutdown program.

## Adjusting for better logs

Anyway, to get an explicit message I put the text below (as root) in a newly created `/etc/acpi/powerbtn.sh` made executable with `chmod a+x /etc/acpi/powerbtn.sh`

<pre>
#!/bin/sh
logger in /etc/acpi/powerbtn.sh, presumably "Power button pressed"
	/sbin/shutdown -h -P now "Power button pressed"
</pre>

Doing it this way will probably make a longer lasting change than modifying `/etc/acpi/powerbtn-acpi-support.sh`. The latter option would probably lose its effect on next upgrade of package `acpi-support-base`.

Notice than Ubuntu 14.04 does it differently (`/etc/acpi/powerbtn.sh` already exists with different content from `acpid` package). Also, Debian 8 probably does it differently. Feel free to offer variants.

## Profit!

And now when the power button is pressed, a line like below appears in `/var/log/messages`, `/var/log/syslog` and `/var/log/user.log`:

 logger: in /etc/acpi/powerbtn.sh, presumably Power button pressed

Now that's an explicit message in the log.