MessageList[n] is a global object assigned to be a list of the names of messages generated during the processing of the n input line.
Only messages that are actually output are included in the list MessageList[n].
The message names in the list are wrapped with HoldForm.
MessageList[n] includes messages generated both by built-in functions and by explicit invocations of Message.
See The Mathematica Book: Section 2.8.21 and Section 2.13.1.
See also: $MessageList.