Swich on IMAP logging on the CAS servers by editing the configuration file –
C:\Program Files\Microsoft\Exchange Server\ClientAccess\PopImap\Microsoft.Exchange.Imap4.exe.config
Find the line (near the end of the file) –
<add key="ProtocolLog" value="false" />
Change false to true and save the file.
Restart the IMAP service for this to take effect. Switch off logging by reversing the above change and restarting the IMAP service.