2

Intellij IDEA Plugin DEV (四)

 2 years ago
source link: https://dong4j.github.io/views/tools/2019/03141253.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Intellij IDEA Plugin DEV (四)


dong4j 3/14/2019 IDEA

查看 IDEA Plugin 开发日志

上一节已经说过, IntelliJ IDEA SDK 中已经有了日志框架, 用于输出日志, 但是在哪里看日志呢.

我们可以这样查看:

-w386

最终我们知道 idea.log 会在 .sandbox/system/log/idea.log.

然后我们可以通过 Grep Console 这个插件的 Tail File in Console 或者 Tail Current File in Console 来实时查看日志.

-w444

-w1101

然后我们会发现所有的日志等级都是 INFO, 在我们调试的时候 DEBUG 日志看不到, 如果全部设置成 INFO 级别调试的时候很方便, 但是大量打印日志有性能损耗, 因此我们需要将日志等级降低, 又能打印到文件中.

你可以这样设置:

-w376-w693

说明已经写得很详细了, 按照上面的来, 然后将调试日志等级设置为 TRACE 即可看见日志.

-w654

其他你也可以直接修改下面这个文件

-w1210

👉 扩展阅读 - 怎么将老的 plugin 项目转换成 gradle 项目

由于官方开发文档写得很烂, 有多东西都没有写到, 所有我们只有看别人的代码来了解未知的 API 的功能.

这里先推荐一款插件 PsiViewer, 能保证我们更加容易理解 PSI

-w1053

准备工作做好了, 接下来进入主题了.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK