All Products
Search
Document Center

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

Last Updated:Feb 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.

LanguageDefault log locationLog destinationConfiguration method
Java${user.home}/logs/nacos/Separate log files by functionJVM parameters
Go/tmp/nacos/log/Single log fileClientConfig fields
PythonApplication logsApplication logging pipelineNacosClient parameters
C++Application directorynacos-sdk-cpp.logsetBaseDir in Logger.cpp
C#Application logsApplication logging pipelineILoggerFactory configuration

Java

Default log location

By default, logs of a Java Nacos client are saved in the ${user.home}/logs/nacos/ directory on the machine where your application runs. ${user.home} is the home directory of the system user that starts the application process.

Log files

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

Log fileDescription
naming.logService registry operations (service registration and discovery)
config.logConfiguration management operations (configuration publishing and listening)
remote.loggRPC connection events. Available in Nacos client 2.0.0 and later.

Configuration

Customize the log path

To change the log output directory, set the JM.LOG.PATH JVM parameter:

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

Change the log level

To adjust the log level for troubleshooting, set one or both of the following JVM parameters:

JVM parameterDescriptionDefault
-Dcom.alibaba.nacos.naming.log.levelLog level for service registry operations (naming.log)info
-Dcom.alibaba.nacos.config.log.levelLog level for configuration management operations (config.log)info

Valid values: debug, info, warn, error.

Example:

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

By default, logs of a Go Nacos client are saved in the /tmp/nacos/log/ directory. All logs are written to a single log file.

Configuration

Set the LogDir and LogLevel fields in ClientConfig to customize 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

The Go Nacos client supports log rotation through the LogRollingConfig field in ClientConfig. Use this to control log file size and retention in production environments.

Python

Default log location

A Python Nacos client uses Python's built-in logging module. Logs are output through the same logging pipeline as your application, so they appear in your application logs.

Configuration

Log rotation

The Python Nacos client supports log rotation. Control the number of retained log files with the log_rotation_backup_count parameter (default: 7).

C++

Default log location

By default, logs of a C++ Nacos client are saved in the directory where your application is located. The log file is named nacos-sdk-cpp.log.

Configuration

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

C#

Default log location

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