Depending on the login manager you use, ~/.profile
is not even executed when you login graphically, see https://superuser.com/questions/752493/profile-in-lxde#847051.
Also, in case it is executed (more technically correct "sourced"), the output to standard output will most likely be discarded.
If you want to write a log message, you could use the logger
command (http://manpages.ubuntu.com/manpages/artful/man1/logger.1.html) to write to the system log, simply by piping your output into the logger command like this:
myCommand | logger