Manage MOSN log levels

更新时间:
复制 MD 格式

Query MOSN log levels

Run the following command to query the MOSN log level:

curl 127.0.0.1:34901/api/v1/get_loglevel

Consider the following example:

{
    "":"INFO",
    "/home/admin/logs/mosn/antvip.access.log":"INFO",
    "/home/admin/logs/mosn/antvip.error.log":"INFO",
    "/home/admin/logs/mosn/fuse.log":"INFO",
    "/home/admin/logs/mosn/mirror.log":"INFO",
    "/home/admin/logs/mosn/msg_meta.log":"INFO",
    "/home/admin/logs/mosn/registry.access.log":"INFO",
    "/home/admin/logs/mosn/registry.error.log":"INFO",
    "/home/admin/logs/mosn/routerecord.log":"INFO",
    "/home/admin/logs/mosn/routerule.log":"INFO",
    "/home/admin/logs/mosn/zoneclient.access.log":"INFO",
    "/home/admin/logs/mosn/zoneclient.error.log":"INFO"
}

Modify log levels

The available log levels are as follows:

  • FATAL: Outputs event logs for critical errors that cause the application to exit.

  • ERROR: Outputs logs for errors and exception messages that do not affect the overall system operation.

  • WARN: Outputs warnings about potential errors. These messages can provide hints to developers and may not indicate an actual error.

  • INFO: Outputs important information about the program's operation. In a production environment, these messages highlight the application's process at a coarse granularity. To avoid excessive logs, use this level sparingly.

  • DEBUG: Outputs runtime information that is useful for debugging applications. This level is typically used during development.

  • TRACE: Outputs trace logs with the finest granularity. This level is not commonly used because it generates a very high volume of log data.

Run the following command to modify the log level:

curl  -d '{"log_level":"INFO","log_path":"./logs/mosn/antvip.access.log}'   127.0.0.1:34901/api/v1/update_loglevel

If the modification is successful, the following message is returned:

update logger success