You can use script command for that

script --quiet myoutput.log
csession cache
work in terminal
hang
exit

If you want to log every command then you can enable it in SMP ->  System Administration -> Security -> Auditing ->  Configure System Events. Once there enable %System/%DirectMode/DirectMode event and every terminal command would be logged along with time and user who executed it. Audit must also be active, of course.

Yes, I'm searching for a ready code downloading from Gmail etc. Or at least code connecting to the server.

ClassMethod GmailAsPOP3() As %Net.POP3
{

  Set server=##class(%Net.POP3).%New()
  
  Set server.port=995

  //just in case we plan to fetch any messages
  //that have attachments
  Set server.StoreAttachToFile=1
  Set server.StoreInlineToFile=1
  Set server.AttachDir="c:\DOWNLOADS\"
  

  Set servername="pop.gmail.com"
  Set server.UseSTARTTLS=1
  Set server.SSLConfiguration = "GMail" //any empty enabled client SSL/TLS config

  Set user="mail@gmail.com"
  Set pass="pass"
  
  Set status=server.Connect(servername,user,pass)
  If $$$ISERR(status)
  {
    Do $System.Status.DisplayError(status)
    Quit $$$ERROR()
    }
  Quit server
}

 

It returns this error:ERROR #6013: Unable to make TCP/IP connection to mail server.  An earlier connection may not have been closed. [zConnectPort+39^%Net.POP3.1:EMAIL]