Q on <user> of syslog message generated by logger command

Generally(at least on AIX5.3, Solaris9, OS X)'logger' command would create syslog messages which carry <login name> . On Solaris9, I have experienced two circumstances in which 'logname' command fails. In this circumstance I saw the 'logger' command generated syslog messages which carry alternatively <real or effective user name> instead of the <login name> that is seemingly unable for the logger to retrieve. One of the circumstances is on shells(either ksh or csh) running on the emacs buffer. For the other one, sorry, I can not tell you here.
Are there any ways by which we can let the logger to create syslog messages with <real or effective user name> instead of <login name>?

Thanks,
masaki

correction: replaced "effective" with "real or effective"