Set-NCacheLogging
The Set-NCacheLogging PowerShell cmdlet enables or disables logging and sets the log level for a cache server or its clients. By default, the cmdlet configures cache server logging. When -Type Client is specified, the settings are applied to the cache's client logging configuration, which clients receive from the cache server when they connect. The changes are applied to all nodes of the cache without requiring a cache restart.
Set-NCacheLogging -CacheName [-Enable] [-Type] `
[-Level] [-Server] [-Port] [-NoLogo] `
[-TlsCertPath] [-TlsCertPassword] `
[-Credentials]
Examples
- This command enables detailed logging on the cache server for defaultCache.
Set-NCacheLogging -CacheName defaultCache -Enable true -Level Detail
- This command sets the cache server log level of defaultCache to Error on all nodes of the cache, contacting the NCache Service on 20.200.20.11 first.
Set-NCacheLogging -CacheName defaultCache -Level Error -Server 20.200.20.11
- This command enables Error-level logging for clients of defaultCache.
Set-NCacheLogging -CacheName defaultCache -Type Client -Enable true -Level Error
- This command disables client logging for defaultCache while retaining the configured log level.
Set-NCacheLogging -CacheName defaultCache -Type Client -Enable false
- This command sets cache server logging to Error level when executed from a machine where NCache is not installed, connecting to an NCache server with mutual TLS (mTLS) enabled. The client certificate authenticates the machine executing the cmdlet, and the password decrypts its password-protected private key. Omit
-TlsCertPasswordif the private key is not encrypted.
Set-NCacheLogging -CacheName defaultCache -Level Error -Server 20.200.20.11 `
-TlsCertPath "C:\certs\client.pem" -TlsCertPassword "clientKeyPassword"
Properties
Note
The parameter marked with an asterisk (*) is required, and the remaining parameters are optional.
| Parameters | Data Types | Description | Default Value |
|---|---|---|---|
-CacheName* |
<String> |
Specifies the name of the cache whose logging settings are to be configured. | - |
-Enable |
<String> |
Enables (true) or disables (false) logging. For -Type Cache, false disables all logging levels and ignores -Level. If set to true without -Level, logging starts at Error when no level was previously enabled. |
Current setting |
-Type |
<LoggingType> |
Specifies whether logging is configured for the cache server (Cache) or the clients of the cache (Client). |
Cache |
-Level |
<LogLevelParam> |
Specifies Error (errors only) or Detail (errors, notices, warnings, and debug information on the cache server; debug-level logging for clients). If omitted, the existing level is retained unless cache logging is disabled. |
Current level |
-Server |
<String> |
Specifies the server on which the NCache Service is running. The cmdlet contacts this server first and applies changes to all cache nodes. | Local machine |
-Port |
<Int32> |
Specifies the port on which the NCache Service listens for management requests. | 9803 |
-NoLogo |
<SwitchParameter> |
Suppresses display of the logo banner. | False |
-TlsCertPath |
<String> |
Specifies the path to the client PEM certificate used to authenticate this cmdlet when the target NCache server requires Mutual TLS. This parameter is required for Mutual TLS connections even when the cmdlet runs on an NCache server. The PEM file must contain the private key, leaf certificate, and any intermediate certificates. Relative paths are resolved against the current PowerShell location, and the file must exist. You can generate a client certificate using New-NCacheTlsCertificate. | - |
-TlsCertPassword |
<String> |
Specifies the password used to decrypt the private key in the PEM file provided through -TlsCertPath. Required only for an encrypted private key. The password is not saved in the NCache server configuration. |
- |
-Credentials |
<PSCredential> |
Specifies user credentials required to authorize access to the NCache server. | - |