Logging Mechanism in MPS
Hi All,
I am trying to use logging mechanism of MPS in several places in my project.
Firstly I've tried to get an info message in the plugin solution that basically opens a Dialog Wrapper when the swing component in the editor is clicked. For this task, I've imported the jetbrains.mps.baseLanguage.logging language and used info statement in the constructor of the Dialog. However I couldn't find the message neither in the message tool view panel nor in log file under MPS_HOME.
I've also used it in my post-process script, however I didn't manage to see any message in there either.
Is there some additional configuration for this logging mechanism?
In the forum I've seen some posts that use BasicConfigurator.configure() method before the logging statements. However it didn't seem to work for me.
Best Regards,
Özlem
Please sign in to leave a comment.
There's a bug in MPS 3.4 that causes log messages not to be displayed in the messages view: https://youtrack.jetbrains.com/issue/MPS-24659. Vote for it to be fixed.
I can see the logging messages by looking at the console from which I started MPS. That means you have to start it from the command line
As far as I know the only setting that exists about logging is the blu info button on the left of the messages tool that say "Show Information Messages". When it is selected "info" statements are working in my MPS.
Actually, I can see the info messages related to MPS in the console as well. But what I want to do is to use this mechanism to show my custom error/info messages in the console. However when I use the "jetbrains.mps.baselanguage.logging" language and its methods (info, error etc.), I couldn't manage to see my custom messages in the "Messages tool view panel".
MPS uses log4j for logging, configured in bin/log.xml. Log4j is used for both MPS' internal logging and the baseLanguage.logging language.
The file configures INFO logging for the root logger and WARN level for com.intellij and #com.intellij categories. (The appender that writes log messages to the Messages view is not listed in the configuration file because it's added at runtime, to the root logger.)
What this all means is that unless you're using the two com.intellij categories, your messages at INFO level should show up in the Messages view automatically. If you want DEBUG-level messages to be shown, you can enable debug logging in Help -> Debug Log Settings.
I suggest you double-check everything one more time and if it still doesn't work, please file a bug report with a small example to reproduce the problem.
Hello,
could you please provide some more information on how to get log output running?
Running a plugin project in MPS, info statements are put to the [user]\MPS34\system\log\idea.log (under windows) file. Unfortunately, I get no messages in the message window.
As I read in some posts (as well in the initial post of this topic), the solution may be to call BasicConfigurator.configure().
What dependency do I need and where to place it (Model or Solution)?
Thank you very much for this information.