With your line, it just writes the date into the log file. No output of my dosomething program.
I tested my program; it works:
This writes the output of my program to the standard output (the terminal) text dosomething
This writes it to the log file text dosomething >> /var/log/dosomething.log
This writes it correctly to the standard output text date +"%Y-%m-%d_%H:%M:%S $(dosomething)"
This writes just the date (%Y-%m-%d_%H:%M:%S) to the log file (running as a script in /etc/network/if-up.d) text date +"%Y-%m-%d_%H:%M:%S $(ifup wlan0 dosomething)" >> /var/log/dosomething.log
I don't know if my program was running.
date=$( date +"%Y-%m-%d_%H:%M:%S" )
something=$(dosomething)
if [ -z "$something" ]
then
echo "dosomething produced no output" >&2
exit 1
fi
printf "%s %s\n" "$date" "$something" >> /var/log/dosomething.log
Well, when the connection to the wlan is there I would expect that my program is running. The program works and gives output but it looks like not with ifup.