Main Content

Read Active Log using API

The MATLAB® Production Server™ API for Reading Active Log lets you read the active log of a MATLAB Production Server instance, which is the main log currently being written to. To read the active log, use GET Active Log.

Enable RESTful API for Reading Active Log

To enable the RESTful API for reading active log, uncomment these entries in the main_config file:

  • --log-endpoint — This entry enables the API.

  • --log-root — This entry specifies the folder containing log files and must be enabled for logging.

These entries also affect the behavior of the API:

  • --log-rotation-size — This entry specifies the maximum size to which the log can grow before it is rotated into the archive area. It determines the maximum size of the response.

  • log-severity — This entry specifies the level of detail with which to add information to the main log.

Read Active Log

The API for reading the active log includes the following GET request.

GET /api/log HTTP/1.1
Host: localhost:9910

This request returns the contents of the main log. The response body has the following form:

1 [2025.03.18 13:50:49.510638] [information] Starting master (pid = 10676)
2 [2025.03.18 13:50:49.511635] [information] Global locale: en_US
3 [2025.03.18 13:50:49.511635] [information] Global encoding: UTF-8
4 [2025.03.18 13:50:49.511635] [information] terminal encoding: UTF-8
11 [2025.03.18 13:50:50.168347] [information] -- log directory: "L:\\server\\test_server\\log"
12 [2025.03.18 13:50:50.169334] [information] configuring WebFunction router
13 [2025.03.18 13:50:50.169334] [information] -- loading routes file: .\config\routes.json
122 [2025.03.18 13:50:51.419418] [information] -- UriPathRegexMatcher: removing old entries. operation=add, component=mps_check, entries=0, exists=false

cURL Example

curl "http://<hostname>:<port>/api/log"

See Also

| | (MATLAB Compiler SDK) | (MATLAB Compiler SDK)

Topics