Apple - How to save chat logs in Messages for Mountain Lion?

In Preferences, select Messages and check "Save history when conversations are closed." Now when you quit Messages, it will create a collection of chat transcripts. You can easily access these in your Library folder. From Finder, select Go>Go to Folder and type: ~/Library/Messages/Archive. If you are on Mavericks or Yosemite, the location is ~/Library/Containers/ This will take you directly to the appropriate folder.

Please note that the new location for logs in Mavericks is ~/Library/Containers/ (yes, even though the app is called Messages, the container is called iChat).

This appears to be a way of replicating the way that apps like iMessages work on iOS -- Messages gets its own Library folder with its own dedicated hierarchy of files.

Update: At some point after 10.9 Mavericks and by the time of 10.15 Catalina, the real location for stored chat logs became ~/Library/Messages/Archive.