Logging in ExternalSystemProjectResolver

Answered

I've implemented an External System for an external build tool. However it can be very difficult to debug when things go wrong due to the fact that project resolution is executed in a background process. I've come up with various hacks - fiddling with MY_SYSTEM.system.in.process in the Registry, and adding VM args in enhanceRemoteProcessing to allow me to debug. But I can't always reproduce what my users are seeing, and it would be really nice to be able to log from the background process. Is this possible? Currently my log messages just disappear.

0
4 comments

There is no general logging delegate mechanism from the external process.

You can add your own logging for the process or use `ExternalSystemTaskNotificationListener#onTaskOutput`  to add your diagnostic messages to the import output. The output should be available at the `Build` tool window `Sync` tab.

You can also pass the "logging" level  using the `enhanceRemoteProcessing` method if you wish to reuse IDE logging configuration. 

0

Thanks Vladislav. I tried doing this from within ExternalSystemProjectResolver.resolveProjectInfo, but it didn't work:

listener.onTaskOutput(id, "Resolving $projectPath", true)

Is that what you meant by using the TaskNotificationListener? I still don't see that output in either the Build tool window or the IDEA log file.

I'm not sure how I would pass the logging level using enhanceRemoteProcessing, how would that work?

0

Yes, the text you sent using `onTaskOutput` should be presented on the Build tool window switched to console mode.

Can I recreate the issue on my machine using your plugin?

0

Ah, I see, thank you - the part I was missing was switching it to console mode. It's working now, thanks.

0

Please sign in to leave a comment.