I've just looked into your question... so it might be too late to answer you since it's been years you've posted it.

You are using a rather old ubuntu that is known/was known at that time to have trouble in that specific domain.

However I encourage you to see this question : How to check battery status using terminal?

The answer of Lekensteyn is the start of what you are looking for.

As you can see in the answer the matter evolves along the kernel version and so the solution ...

To be more specific and retaking your conditions (get status and ubuntu 12.04), you need upower in your system and can create a script like :

#!/bin/sh
DATE=$(date +%Y-%m-%d:%H:%M:%S)
STATE=$(upower -i /sys/class/power_supply/BAT0 | awk '/state/ {print $2}')
echo "$DATE $STATE" >> /var/log/battery_status.log

Then add it in a monitoring process loop ... or a crontab.

It might need root privilege (sudo)

Hope this helps.