How to disable FEniCS messages?

Hello,

I am trying to disable some messages for my code so that only necessary informations are printed out. Here are the two messages so far I have not clue how to disable:

Calling FFC just-in-time (JIT) compiler, this may take some time.

Newton solver finished in 2 iterations and 2 linear solver iterations.

Some codes I have for setting up the Newton solver:

solver = NewtonSolver()
solver.parameters["linear_solver"] = "lu"
solver.parameters["convergence_criterion"] = "incremental"
solver.parameters["relative_tolerance"] = 1e-6
solver.parameters["report"] = False

Let me know if there’s any trick I could use to disable the above two messages.

Thanks.

P.S. : the only types of messages I want to keep are error messages, and anything in print( )

set_log_level(LogLevel.ERROR) will remove most of the output.

1 Like