All Products
Search
Document Center

Microservices Engine:How do I obtain logs from a Nacos client?

Last Updated:May 27, 2026

Nacos client logs help you troubleshoot connectivity issues, configuration synchronization failures, and service registration problems. The log location and configuration method depend on the programming language of your Nacos client.

Quick reference

The following table summarizes the default log location and configuration method for each supported language.

Language

Default log location

Log destination

Configuration method

Java

${user.home}/logs/nacos/

Separate log files by function

JVM parameters

Go

/tmp/nacos/log/

Single log file

ClientConfig fields

Python

Application logs

Application logging pipeline

NacosClient parameters

C++

Application directory

nacos-sdk-cpp.log

setBaseDir in Logger.cpp

C#

Application logs

Application logging pipeline

ILoggerFactory configuration

Java

Default log location

Java Nacos client logs are written to ${user.home}/logs/nacos/ on the machine where your application runs. ${user.home} is the home directory of the OS user that starts the application process.

Log files

The Java Nacos client writes to separate log files based on function:

Log file

Description

naming.log

Service registry operations (service registration and discovery)

config.log

Configuration management operations (configuration publishing and listening)

remote.log

gRPC connection events. Available in Nacos client 2.0.0 and later.

Configuration

Use JVM parameters to customize the log path and level:

JVM parameter

Description

Default

JM.LOG.PATH

Log output directory

${user.home}/logs/nacos/

-Dcom.alibaba.nacos.naming.log.level

Log level for service registry operations (naming.log)

info

-Dcom.alibaba.nacos.config.log.level

Log level for configuration management operations (config.log)

info

Valid values: debug, info, warn, error.

Example — change the log directory:

java -DJM.LOG.PATH=/custom/path/logs -jar your-application.jar

Example — set both log levels to debug for troubleshooting:

java -Dcom.alibaba.nacos.naming.log.level=debug \
     -Dcom.alibaba.nacos.config.log.level=debug \
     -jar your-application.jar

Known issues

In earlier versions of Spring Cloud, the framework may override Nacos client log configurations. When this happens, Nacos client logs appear in your application logs instead of the default ${user.home}/logs/nacos/ directory.

This can also occur when your application uses Log4j 1.x, which does not support the Nacos client's default logging configuration.

If Nacos client logs are missing from the default directory, check your application logs first.

Go

Default log location

Go Nacos client logs are written to /tmp/nacos/log/ in a single log file.

Configuration

Set the LogDir and LogLevel fields in ClientConfig to change the log directory and verbosity:

clientConfig := constant.ClientConfig{
    LogDir:   "/tmp/nacos/log",   // Log output directory
    LogLevel: "debug",            // Valid values: debug, info, warn, error (default: info)
}

Log rotation

Control log file size and retention in production environments using the LogRollingConfig field in ClientConfig.

Python

Default log location

The Python Nacos client uses Python's built-in logging module and shares your application's logging pipeline. Logs appear in your application logs.

Configuration

Log rotation

Control the number of retained log files with the log_rotation_backup_count parameter (default: 7).

C++

Default log location

C++ Nacos client logs are written to nacos-sdk-cpp.log in the directory where your application is located.

Configuration

To change the log directory, call setBaseDir in the Logger.cpp file.

C#

Default log location

The C# Nacos client requires an ILoggerFactory instance from Microsoft.Extensions.Logging during initialization. Logs follow your application's logging settings and appear alongside your application logs.