Can't see log output from my plugin
I have created a logger using
private final static Logger LOG = Logger.getInstance(MyTask.class);
and am trying to get output from it using
} finally {
double dt = (System.currentTimeMillis() - startTime) / 1000.0;
String content = this.getClass().getSimpleName() + " task took " +dt+ "s.";
// problem: I'm not seeing the log entries from the following line
LOG.info(content);
// but if I run the plugin from IJ I see this in the console
System.err.println(content);
// and after this notify I also see it in the child IJ's event log
Notifications.Bus.notify(new BaloonlessNotification(
"MyGroup", "", content, NotificationType.INFORMATION));
}
I see the console output from the System.err.println, and the notification in the event log. But nothing shows up in either idea.log or build.log
The code in question is being run as a before task, added to the compile action using
CompilerManager.getInstance(myProject).addBeforeTask(myTask)
Are these tasks run in some strange process state where neither of the normal log files applies? How do I get my output logged to an accessible place?
请先登录再写评论。
What is the full name of `Logger` class you're using?
import com.intellij.openapi.diagnostic.Logger;
To get log output at INFO (and DEBUG) level, do one of the following...
In the Help->Debug Log Settings dialog, add "MyTask:DEBUG"
Or, in code:
Eric, INFO level should be printed to the log by default. If you need to enable debug level for some logger, you need to add `#<full class name>` line in Debug Log Settings, without `:DEBUG` suffix.
Richard, how do you start the IDE? Do you start it via .bat/.sh/.exe file or run it from sources using 'IDEA' run configuration? Or via gradle task?
I am starting it from a Gradle task, I think...either our own task (when it's bundled into our product) or the build task that runs the custom plugin from inside the IntelliJ development environment.
Sorry if I jump into the discussion.
I'm developing a plugin. I start the sandbox using the runIde task from IDEA run configuration. When the sandbox application starts, I do set via Help->Debug Log Settings dialog the entry 'com.mypackage.MyClass'. I'm using the logger
Howewer, I can only see info and warn logs, none at debug level.
Any hint?
Michele, how do you get the Logger instance? If you're using Logger.getInstance(Class) method, it adds '#' to the category name (see its sources), so you need to specify #com.mypackage.MyClass in Debug Log Settings.
Also, note that if you're looking for the logs in the debug window, there is a dropbox on the right hand side that sets a level for filtering less important log messages (e.g. debug).