14. MFSERV Log

14.1. Default logs files

MFSERV produces logs files stored in the log directory of the MFSERV root directory.

Logs parameters as log retention, log level are configured in the [log] section of the config/config.ini file in the MFSERV root directory. Check this file for further details.

Each MFSERV plugin has its own logs files:

  • app_{pluginname}{appname}{workern}.stdout

  • app_{pluginname}{appname}{workern}.stderr

There is one log file per worker. For instance, if the workers setting in the plugin configuration file is 4, you will find 4 .stdout log files and 4 .stderr log files for your plugin.

The .sddout file contains INFO and DEBUG level logs. The .stderr file contains WARNING, ERROR and CRITICAL.

When you want to log data from a MFSERV plugin, you just have to call one of the implemented methods:

  • Python plugin with mflog:

    from mflog import get_logger
    logger = get_logger("myapp")
    
    ...
    logger.info(...)
    logger.debug(...)
    logger.warning(...)
    logger.error(...)
    logger.critical(...)
    logger.exception(...)
    
  • Node.js plugin:

    console.log(...)
    console.info(...)
    console.warn(...)
    console.error(...)
    

    or

    const process = require('process')
    
    process.stdout.write(...)
    process.stderr.write(...)
    

See also

mfadmin:mfadmin_miscellaneous:Exporting logs

14.2. Custom logs files

14.2.1. Classic Python logger

You may want to create your own additional logs files to log specific data and store it in the MFSERV log directory. In order to do this, check this example.

14.2.2. Metwork MFLOG logger

You may also use the ‘structured’ Metwork MFLOG logger. Check Metwork MFLOG for more details and example.