Can OpenFin save Logs to a private database and how to retrieve logs from %LocalAppData%\openfin\apps\<app>\app.log

107 Views Asked by At

System Versions

What is currently running, system-wise, with this setup:

  • OpenFin Process Manager Version: RVM = 8.1.0.4
  • Node.js: v16.15.0
  • Windows 10
  • Angular Application with C# .NET backend

Problem:

Currently, all application logs are saved locally on users' computers instead of in a centralized location for review and debugging. I noticed in the OpenFin Documentation that there is a sendApplicationLog() method, but the documentation only explains the parameters the function takes. I tried running this method manually in an OpenFin instance, but I got no output. Is there more documentation on how OpenFin can send logs to a remote location or how to direct the logs to a specific destination?

  • Can OpenFin directly import these logs to a protected database?

  • Is there a good alternative to feeding everything in the console output to a consolidated location?

    • Attempts:
      • I tried using Angular's global error-catching feature to intercept any global errors, but it doesn't catch warnings.
      • Can a global errorHandler be adapted to handle warnings and info in addition to errors?

Thank you.

1

There are 1 best solutions below

5
John Kennedy On BEST ANSWER

OpenFin provide a service where application logs can be encrypted and uploaded to a remote location managed by OpenFin. You can then retrieve the logs using the Log Manager api.

There are two methods to activate this.

You can enable app log management in the application manifest

{
  "licenseKey": "contract_identifier",
  "startup_app": {
    "enableAppLogging": true,
    "logManagement": {
      "enabled": true, 
    }
  }
}

Or you can use the sendApplicationLog api you mention in your question.

Relevant OpenFin developer documentation can be found here:

https://developers.openfin.co/of-docs/docs/log-management

https://developers.openfin.co/of-docs/reference/get_api-v1-applications

USE FOLLOWING AT OWN RISK

There is an undocumented and unsupported feature that allows you specify an alternative location to send logs to.

Your application manifest would need to include this:

"logManagement": {
  "enabled": true,
  "url": "<YOUR_URL_ENDPOINT>"
}

OpenFin support would not be drawn on what RVM / Runtime versions this is available in, and you should consider the possibility it could be removed without warning in newer versions.