By default, preCICE provides a meaningful logging output to stdout. In case you want to modify the default logging, this page describes how to do this.


Logging in preCICE is based on boost.log.

For debug logging, you need to build preCICE in debug mode. Please note that the Debian packages are not built in debug mode.

In principle, to modify the logging, you simply define your own logging. This is done in the preCICE configuration file. We start here with a dummy example. Further below, you can find useful examples for certain use cases:

  <log enabled="true">
    <sink type="stream" output="stdout" format="Hello %Message%" 
          filter="%Severity% > debug"  enabled="true" />
    <sink type="file" output="debug.log" filter="" enabled="false" />
  <solver-interface dimensions="3">

This configures two sinks: the first one logs to stdout, uses a somehow absurd logging format and filters, so that the messages with a severity higher than debug are printed. The other, disabled one, uses an empty filter, thus printing all messages and writes them to a file. Beware: because of trace messages this file might become huge.

<log> has one attribute:

  • enabled can be used to completely disable logging. It defaults to true.

Each sink has these attributes:

  • type can be stream or file
  • output can be stdout or stdin if type=stream or a filename if type=file
  • format is some boost.log format string.
  • filter is a boost.log filter string. The default filter string is %Severity% > debug
  • enabled is a boolean value. It can be one of 0, 1, yes, no, true, false Note that if all sinks are disabled, the default sink is used. Use <log enabled="false"> to completely disable logging.

The <log> tag is optional. If it is ommitted, default values are used. type and output are mandatory, all others attributes are optional.


Logging can also be configured using a file log.conf in the current working directory. This is the way to configure logging when you run tests via testprecice.

Filter = (%Severity% > debug) or (%Module% contains "PetRadialBasisFctMapping")
Format = %Message%

Filter = 
Type = file
output = precice.log

The [SectionHeaders] are just for distingushing the sections, the names are not used.


Attributes available to the filter and the formatter are:

Attribute Description
Severity Severity, can be trace, debug , info, warn, error
File The absolute path to the file at the log location.
Line The line number of the log location.
Function The function at the log location.
Module The module at the log location. This is mostly the class holding the logger.
Rank The MPI rank producing the log
Participant The name of the current participant, e.g., Fluid


  • All info messages, but also trace and debug logging for the interface of preCICE. This logging is very useful if you want to find out if the coupled simulation crashes in preCICE or in your solver.
    <sink type="stream" output="stdout"  filter= "(%Severity% > debug) or (%Severity% >= trace and %Module% contains SolverInterfaceImpl)"  enabled="true" />   
  • The standard preCICE info output, but in a more compact format. This can be useful if preCICE works fine and you simply want to focus on your solver’s output.
    <sink type="stream" output="stdout"  filter= "%Severity% > debug and %Rank% = 0" format="preCICE: %ColorizedSeverity% %Message%" enabled="true" />  
  • To debug where initialization hangs:
    <sink type="stream" output="stdout"  filter= "(%Severity% > debug) or (%Severity% >= debug and %Module% contains SolverInterfaceImpl) or (%Severity% >= debug and %Module% contains partition) or (%Severity% >= debug and %Module% contains PointToPointCommunication)"  enabled="true" /> 
  • You want to look at your output in an editor and the colors (ANSI escape codes) destroy the formatting.
    <sink type="file" output="precice.log"  filter= "%Severity% > debug and %Rank% = 0" format="(%Rank%) [%Module%]:%Line% in %Function%: %Severity% %Message%" enabled="true" />   
  • You develop in preCICE and want also trace output for PetRadialBasisFctMapping.
    <sink type="stream" output="stdout"  filter= "(%Severity% > debug and %Rank% = 0) or (%Severity% >= trace and %Module% contains PetRadialBasisFctMapping)" enabled="true" />    
  • Filter according to participant and put the messages into different files.
    <sink type="file" output="debug_Fluid.log" filter="%Participant% = Fluid" />
    <sink type="file" output="debug_Solid.log" filter="%Participant% = Solid" />

Note, that the files debug_Fluid.log and debug_Solid.log are created in any case, so you may end up with empty files if everything has been filtered out.