This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

log messages to file

+1 vote

Is it possible to log all fenics messages to a file during a run from let's say python? i know this could be done fron the prompt but I am wondering if there's anything built-in.

asked Jun 23, 2014 by chaffra FEniCS User (1,830 points)

1 Answer

+1 vote

No, and it is actually pretty tricky.

In C++ one can create a log stream and attach that to the logger. However, Python is wrapping C, and inside the C object of a File in Python we have a C File pointer. The trick is to get the this file pointer from C-Python and turn it into a ostream in C++. I tried a couple of years ago but failed...

Do not expect that I will try again in any reasonable time :)

answered Jun 23, 2014 by johanhake FEniCS Expert (22,480 points)
...