- The dropdown seen below is populated by the resolved Promise's name attribute returned by the getLogList API.
- Clicking the button under the debug log list retrieves the correct log by passing in the the name parameter to the getLog API, and submits an HTTP POST request to
http://localhost:5050/uploads
with the selected the File Object's contents. - The server registers an endpoint
/uploads
that handles HTTP post requests via a middleware function that parses and collects the File Object created with content's, and saves to disk under the pathpublic/uploads/runtimelogs
.
-
Enable application logging as seen in this application's manifest (this will capture and write console log messages from within the platform and write it to disk)
"enableAppLogging": true, "logManagement": { "enabled": true, "url": "http://localhost:5050" }
-
Add the exact endpoint/path
"/api/v1/logs"
to the server root defined inlogManagement.url
. Please note: this is required for the RVM to send an HTTP POST request with the Application log contents. -
The server registers a REQUIRED exact endpoint
/api/v1/logs
that handles HTTP post requests via a middleware function that parses and collects the zip file containing the application logs, and saves to disk under the pathpublic/uploads/applogs
.
An example that uses the Origin Private File System to create a log file that is private to the application but resides on disk. This file is written to via the provider and a log API exposed through the Channel API. The use of the Channel API to capture log messages from views and the provider is just an example (and is not intended for high frequency logging like debug, info). If your content is from the same domain there are other options such as Shared Web Workers or Broadcast Channels or a library that uses the OPFS directly from the view/window.
The example writes log messages sent via the Channel API to a simple log.log file against the OPFS. When it is uploaded it reads the contents of the log from the OPFS and posts the content to "/opfsuploads"
. This is written to public/uploads/opfslogs
using the node server. The log file within OPFS is then cleared. This is just an example to show the option of OPFS.
Follow the instructions below to get up and running.
- Install dependencies and do the initial build. Note that these examples assume you are in the sub-directory for the example.
npm run setup
- Build the project.
npm run build
- Start the test server in a new window.
npm run start
- Start the Platform application.
npm run client