How can I handle logging in a plugin?
Is the following line of code correct? I’m not sure where the log message is being written or how to view it.
EnvironmentManager.Instance.Log(false,
$“Unhandled exception in init func: {exception?.Message ?? “Unknown error”}”,
“MyPlugin”);
The logging is done in the environment hosting the plugin. If you have a Smart Client plugin the logging will end up at [C:\ProgramData\Milestone\XProtect](file:C:/ProgramData/Milestone/XProtect) Smart Client
More information on how to log and the Smart Client handling can be found here - https://developer.milestonesys.com/s/article/debugging-techniques-for-Smart-Client-plugins
Similar for plugins to the Management Client and Event Server find more information:
https://supportcommunity.milestonesys.com/s/article/debugging-techniques-for-Management-Client-plugins?language=en_US
https://supportcommunity.milestonesys.com/s/article/debugging-techniques-for-Event-Server-plugins?language=en_US
I think you have switched the parameters (where and text), but once you see the logs for yourself it will be easy to see if you get what you expect.
https://doc.developer.milestonesys.com/html/index.html?base=miphelp/class_video_o_s_1_1_platform_1_1_environment_manager.html&tree=tree_search.html?search=environmentmanager.log