GDM itself will use syslog to log errors or status.  It can also log
debugging information, but this is not generally useful unless
something is very wrong, and this must be enabled in the configuration
file.
Output from the various X servers is stored in the GDM log directory,
which is configurable, but is usually
<var>/log/gdm/.  The output from the
session can be found in a file called
<display>.log.  Four older files are also
stored with .1 through
.4 appended.  These will be rotated as new
sessions on that display are started.  You can use these logs to view
what the X server said when it started up.
The output from the user session is redirected to
~/.xsession-errors
before even the PreSession script is started.  So
it is not really necessary to redirect this again in the session setup
script.  As is usually done.  If the user session lasted less then
10 seconds, GDM assumes that the session crashed and allows the user to
view this file in a dialog before returning to the login screen.
This way the user can view the session errors from the last session
and correct the problem this way.
You can suppress the 10 second warning by returning code 66 from the
Xsessionscript or from your session binary (the
default Xsession script propagates those codes
back).  This is useful if you have some sort of special logins for
which it is not an error to return less then 10 seconds later, or if
you setup the session to already display some error message and the
GDM message would be confusing and redundant.
The session output is piped through the GDM daemon and so the
~/.xsession-errors file is capped at about
200 kilobytes by GDM to prevent a possible denial of service attack
on the session.  An app could perhaps on reading some wrong data print
out warnings or errors on the stderr or stdout.  This could perhaps
fill up the users home directory who would then have to log out and
log back in to clear this.  This could be especially nasty if quotas
are set.  GDM also correctly traps the XFSZ signal and stops writing
the file, which would lead to killed sessions if the file was
redirected in the old fashioned way from the script.
Note that some distributors seem to override the
~/.xsession-errors redirection and do it
themselves in their own Xsession script (set by the
BaseXsession configuration key) which means that
GDM will not be able to trap the output and cap this file.  You also
lose output from the PreSession script which can
make debugging things harder to figure out as perhaps useful output
of what is wrong will not be printed out.  See the description of the
BaseXsession configuration key for more
information, especially on how to handle multiple display managers
using the same script.
Note that if the session is a failsafe session, or if GDM can't open
this file for some reason, then a fallback file will be created in the
/tmp directory named
/tmp/xses-<user>.XXXXXX where the
XXXXXX are some random characters.
If you run a system with quotas set, it would be good to delete the
~/.xsession-errors in the
PostSession script.  Such that this log file
doesn't unnecessarily stay around.
