MPS 2020.2 Help


The jetbrains.mps.baselanguage.logging language contains statements for writing arbitrary information into the MPS log as well as to the Messages tool view panel. The LogLowLevelStatement concept (aka "log error ...") is used for logging using the system logger, while MsgStatement (aka "message error...") is used for logging into the Messages tool window.

log6 png

The Messages tool window is located at the bottom of the screen:

messages tool window png

The MPS log file can be quickly navigated to using the menu:

Locate Logs png

The language supports different severities of log messages:

  • trace

  • info

  • debug

  • warn

  • error

  • fatal

Whenever you want to insert a log statement into code, start by typing either "log" or "message" followed by the desired severity:

log1 png

Upon completion the log statement with an empty message will be inserted.

log2 png

The severity level can always be changed:

log3 png

The log statement also supports exceptions to be specified:

log4 png

MsgStatement contains an additional parameter to specify the project:

log5 png

When multiple projects are open in MPS at the same time, each project gets its own MPS windows and thus also its own Messages view. The project parameter is used to output the log message into the Messages window of the right project. If you leave the parameter empty, the message will be logged into Messages tool views of all open projects.

Last modified: 08 May 2020