Manage Log Files

Best Practices for Log Management

Use these recommendations as a guide when defining values for the options listed in Log Retention and Archive Settings.

  • Avoid placing log-root and log-archive-root on different physical file systems.

  • Place log files on local drives, not on network drives.

  • Send MATLAB® output to stdout. Develop an appropriate, consistent logging strategy following best MATLAB coding practices. See MATLAB Programming Fundamentals for guidelines.

Log Retention and Archive Settings

Log data is written to the server's main.log file for as long as a specific server instance is active, or until midnight. When the server is restarted, log data is written to an archive log, located in the archive log folder specified by log-archive-root.

You can set parameters that define when main.log is archived using the following options in each server's main_config file.

  • log-rotation-size — When main.log reaches this size, the active log is written to an archive log (located in the folder specified by log-archive-root).

  • log-archive-max-size — When the combined size of all files in the archive folder (location defined by log-archive-root) reaches this limit, archive logs are purged until the combined size of all files in the archive folder is less than log-archive-max-size. Oldest archive logs are deleted first.

Specify values for these options using the following units and notations:

Represent these units of measure...Using this notation...Example
Byte b900b
Kilobyte (1024 bytes)k700k
Megabytes (1024 kilobytes)m40m
Gigabytes (1024 megabytes)g10g
Terabytes (1024 gigabytes)t2t
Petabytes (1024 terabytes)p1p

    Note:   The minimum value you can specify for log-rotation-size is 1 megabyte.

    On Windows® 32-bit systems, values larger than 232 bytes are not supported. For example, specifying 5g is not valid on Windows 32-bit systems.

Setting Log File Detail Levels

The log level provides different levels of information for troubleshooting:

  • error — Notification of problems or unexpected results.

  • warning — Events that could lead to problems if unaddressed.

  • information — High-level information about major server events.

  • trace — Detailed information about the internal state of the server.

The log level is set using the log-severity configuration property.

Before you call support, you should set logging levels to trace.

Was this topic helpful?