Lync doesn't have any built in capability to log IMs to a local file. So I built an add-on to do so. Download, unzip and run LyncLog.exe. It will automatically hook into Lync when it is launched and log your IMs to a folder inside My Documents called Lync Conversations. If you want the logger to always run then stick a shortcut to LyncLog.exe in the startup folder on your start menu.
If there's something you'd like to see added please leave a comment and let me know. If I have time I may take a crack at it.
UPDATE Nov 2, 2011: Added check to only allow a single instance of the app to run at a time.
UPDATE April 3, 2012: Here's the requested version built with framework 3.5.