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

How can I diable log and debug messages from FFC?

+7 votes

I am consuming fenics in my library for spatial stochastic simulations (github.com/pyurdme/pyurdme). When running jobs using Ipython, I get swamped with annoying messages from FFC, such as

Calling FFC just-in-time (JIT) compiler, this may take some time.
DEBUG:FFC Reusing form from cache

Since these messages gets sent around in Ipython Cluster, they are inconvenient. Also, they gets displayed in the IPython Notebook.

How can I disable all messages from Dolfin and FFC/UFL below ERROR level? I have tried the following

dolfin.set_log_level(dolfin.ERROR)
import ffc.log
ffc.log.set_level(ffc.log.ERROR)

With no luck.

asked May 27, 2014 by ahellander FEniCS Novice (220 points)

2 Answers

+1 vote

You shouldn't get the DEBUG messages. They do occasionally get left in in the development version.

I don't think it's possible to turn the other messages off. Please register an Issue on this at https://bitbucket.org/fenics-project/ffc/issues.

answered Jun 23, 2014 by Garth N. Wells FEniCS Expert (35,930 points)
+6 votes

For others searching for this the answer is to change the default log level in FFC from DEBUG to something else. You can do this with the standard Python logging module:

import logging
ffc_logger = logging.getLogger('FFC')
print 'Log level was:', logging.getLevelName(ffc_logger.getEffectiveLevel())
ffc_logger.setLevel(logging.WARNING)
print 'Log level is now:', logging.getLevelName(ffc_logger.getEffectiveLevel())

Put something like this in the top of the notebook and FFC will get a lot less verbose:

import logging
logging.getLogger('FFC').setLevel(logging.WARNING)

It would be an idea to not have log level DEBUG by default

answered Feb 27, 2015 by Tormod Landet FEniCS User (5,130 points)

I got these messages, when I started my own loggers. Thanks to your hint, I could turn them off by using this bunch of comments ("rothemain.rothe_utils" is my logger):

import logging
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger("rothemain.rothe_utils")
logging.getLogger('UFL').setLevel(logging.WARNING)
logging.getLogger('FFC').setLevel(logging.WARNING)
...