ipystata icon indicating copy to clipboard operation
ipystata copied to clipboard

more on log files

Open kflamm opened this issue 8 years ago • 2 comments

Hi. Just wanted to point out that while "import os" in cell above enables writing of log file, it also seems to turn off output to the Jupyter notebook. So you can have one or the other, but not both-- output to Jupyter notebook and a log file. It would be nice to be able to get both-- command window output to Jupyter AND a log file. A nice enhancement if there is an easy way to do this.

Thanks again for writing this terrific Stata magic...

kflamm avatar Jul 29 '17 15:07 kflamm

Re-reading your previous issue I realized that I misunderstood the problem. Yes, the way that ipystata captures the output is by opening up a log file, and Python will monitor this log-file to create the output shown in the Jupyter Notebook. In my perception the notebook becomes the log file on steroids so I have never tried to also save a log file while using ipystata with the Jupyter Notebook.

Having said that, looking at the help file for log I believe you should be able to create your own log file without interfering with the main log file by using the name(...) argument, like: log using mylog, replace name(mylog).

From the help file:

name(logname) specifies an optional name you may use to refer to the log
        while it is open.  You can start multiple log files, give each a
        different logname, and then close, temporarily suspend, or resume
        them each individually.  The default logname is <unnamed>.

I don't have the ability to test it myself right now, but if it doesn't work let me know and we can figure out a way to make it work.

TiesdeKok avatar Jul 29 '17 15:07 TiesdeKok

I will give it a try and let you know.

              Thanks!

kflamm avatar Jul 29 '17 19:07 kflamm