---
source_url: https://www.pubnub.com/docs/sdks/unreal/logging
title: Logging for Unreal SDK
updated_at: 2026-05-25T11:29:38.852Z
sdk_name: PubNub Unreal SDK
sdk_version: 2.0.5
---

> Documentation Index
> For a curated overview of PubNub documentation, see: https://www.pubnub.com/docs/llms.txt
> For the full list of all documentation pages, see: https://www.pubnub.com/docs/llms-full.txt


# Logging for Unreal SDK

PubNub Unreal SDK, use the latest version: 2.0.5

This page explains how to configure logging in the PubNub Unreal Software Development Kit (SDK) using log levels, custom loggers, and structured logging.

For general logging concepts and best practices applicable to all PubNub SDKs, see [Logging](https://www.pubnub.com/docs/general/setup/logging).

## Logging architecture

The SDK provides a flexible logging system that you can configure for different environments and use cases:

* Dual log sources: Logs originate from the UE SDK layer (C++) and the underlying C-Core library. You can filter each source independently.
* Default logger: A built-in logger (`UPubnubDefaultLogger`) routes all messages to Unreal's `UE_LOG` system, which outputs to the Output Log and log files.
* Custom loggers: You can add custom logger implementations via the `IPubnubLoggerInterface` interface to route logs to external systems.
* Structured logging: Every log entry is an `FPubnubLogMessage` struct that includes the log level, source, timestamp, callsite, and PubNub instance ID.

The SDK sends all log entries to every registered logger. Each logger independently filters messages based on its own minimum log level settings.

## Log levels

The SDK uses six log levels, ordered from most verbose to least verbose:

| Level | Enum value | Purpose |
| --- | --- | --- |
| Trace | `EPubnubLogLevel::PLL_Trace` | Internal operations, detailed execution flow, and serialization steps |
| Debug | `EPubnubLogLevel::PLL_Debug` | User inputs, API parameters, HTTP requests and responses, and configuration properties |
| Info | `EPubnubLogLevel::PLL_Info` | Significant events like successful initialization and configuration changes |
| Warning | `EPubnubLogLevel::PLL_Warning` | Non-breaking issues, unusual conditions, and deprecation warnings |
| Error | `EPubnubLogLevel::PLL_Error` | Errors, failed operations, and exceptions |
| None | `EPubnubLogLevel::PLL_None` | Disables logging |

## Log sources

The SDK distinguishes between two log sources using `EPubnubLogSource`:

| Source | Description |
| --- | --- |
| `PLS_UE` | Logs from the Unreal Engine SDK layer. These cover API call parameters, configuration, and SDK-level events. |
| `PLS_CCore` | Logs from the underlying C-Core library. These cover network requests, network responses, protocol-level errors, and internal state. |

Each registered logger has separate minimum level settings for each source. This lets you, for example, capture detailed UE SDK logs at `Debug` while suppressing verbose C-Core output by setting it to `None`.

## Enable logging

The SDK registers a default logger at startup which you don't have to configure.

### Default logger

The SDK registers `UPubnubDefaultLogger` during client initialization. It routes messages to `UE_LOG` under the `PubnubLog` category with default minimum levels of `PLL_Warning` (UE SDK) and `PLL_None` (C-Core).

| PubNub log level | `UE_LOG` verbosity |
| --- | --- |
| Trace, Debug, Info | `Log` |
| Warning | `Warning` |
| Error | `Error` |

To capture more detail, lower the minimum levels at [initialization](#configure-logging-at-initialization) or [at runtime](#change-log-levels-at-runtime). To disable the default logger and use only custom loggers, set `bEnableDefaultLogger = false` in `FPubnubLoggerConfig`.

### Configure logging at initialization

Use `FPubnubLoggerConfig` inside `FPubnubConfig` to configure logging when you create a PubNub client. The following table describes the available configuration fields:

| Field | Default | Description |
| --- | --- | --- |
| `bEnableDefaultLogger` | `true` | When `true`, the built-in default logger is registered during client initialization. Set to `false` to disable it entirely and rely only on your custom loggers. |
| `DefaultLoggerMinLevel` | `PLL_Warning` | Minimum log level for the default logger for UE SDK logs. |
| `DefaultLoggerMinCCoreLevel` | `PLL_None` | Minimum log level for the default logger for C-Core logs. |
| `InitialLoggers` | Empty | Additional custom logger objects to register during initialization. Each object must implement `IPubnubLoggerInterface`. |

:::tip Reference code
Set up your Unreal project and follow the instructions in the lines marked with
ACTION REQUIRED
before running the code.
:::

##### Actor.h

```cpp
#include "PubnubClient.h"

UFUNCTION(BlueprintCallable, Category = "Pubnub|Samples|Configuration")
void SetLogLevelInConfigurationSample();
```

##### Actor.cpp

```cpp
// ACTION REQUIRED: Replace ASample_Configuration with name of your Actor class
void ASample_Configuration::SetLogLevelInConfigurationSample()
{
	//Get PubnubSubsystem from GameInstance
	UGameInstance* GameInstance = UGameplayStatics::GetGameInstance(this);
	UPubnubSubsystem* PubnubSubsystem = GameInstance->GetSubsystem<UPubnubSubsystem>();

	//Set logger levels directly in client configuration before creating PubnubClient
	FPubnubConfig PubnubConfig;
	PubnubConfig.PublishKey = TEXT("demo");   //replace with your Publish Key from Admin Portal
	PubnubConfig.SubscribeKey = TEXT("demo"); //replace with your Subscribe Key from Admin Portal
	PubnubConfig.UserID = TEXT("Player_001");
	PubnubConfig.LoggerConfig.DefaultLoggerMinLevel = EPubnubLogLevel::PLL_Debug;
	PubnubConfig.LoggerConfig.DefaultLoggerMinCCoreLevel = EPubnubLogLevel::PLL_Warning;

	UPubnubClient* PubnubClient = PubnubSubsystem->CreatePubnubClient(PubnubConfig);

	//Use PubnubClient as needed
	PubnubClient->PublishMessageAsync(TEXT("test-channel"), TEXT("Hello, world!"));
}
```

### Change log levels at runtime

You can retrieve registered loggers and adjust their minimum levels at any point after initialization.

:::tip Reference code
Set up your Unreal project and follow the instructions in the lines marked with
ACTION REQUIRED
before running the code.
:::

##### Actor.h

```cpp
#include "PubnubClient.h"

UFUNCTION(BlueprintCallable, Category = "Pubnub|Samples|Configuration")
void SetLogLevelAtRuntimeSample();
```

##### Actor.cpp

```cpp
// ACTION REQUIRED: Replace ASample_Configuration with name of your Actor class
void ASample_Configuration::SetLogLevelAtRuntimeSample()
{
	// snippet.hide
	UPubnubClient* PubnubClient = GetPubnubClient();
	// snippet.show

	//Assumes PubnubClient is created and UserID is set

	//Get all registered loggers
	TArray<TScriptInterface<IPubnubLoggerInterface>> Loggers = PubnubClient->GetLoggers();
	if (!Loggers.IsEmpty())
	{
		//Set new log levels for the first logger
		IPubnubLoggerInterface::Execute_SetMinimumLogLevel(Loggers[0].GetObject(), EPubnubLogLevel::PLL_Debug);
		IPubnubLoggerInterface::Execute_SetMinimumCCoreLogLevel(Loggers[0].GetObject(), EPubnubLogLevel::PLL_Warning);
	}
}
```

## Structured logging with FPubnubLogMessage

Every log entry the SDK dispatches to loggers is an `FPubnubLogMessage` struct. This provides structured information you can use to filter, format, or route log messages:

| Field | Type | Description |
| --- | --- | --- |
| `LogLevel` | `EPubnubLogLevel` | Severity level of the log message. |
| `Source` | `EPubnubLogSource` | Whether the log originated from the UE SDK (`PLS_UE`) or C-Core (`PLS_CCore`). |
| `Message` | `FString` | The log content. For C-Core logs, this includes formatted network request/response details and error information. |
| `TimestampUtc` | `FDateTime` | UTC timestamp of when the log message was created. |
| `Callsite` | `FString` | Optional source class or method that generated the log. |
| `PubnubInstanceID` | `FString` | PubNub client instance identifier, useful for distinguishing logs from multiple clients. |

The default logger formats these fields into a single line:

```text
2026-02-25T12:18:11.797Z [UE-SDK] PubNub-1 DEBUG [UPubnubClient::SubscribeToChannel_priv] Subscribing to channel...
2026-02-25T12:18:11.823Z [C-Core] PubNub-ee43324a DEBUG Network request: https://ps.pndsn.com/subscribe/...
```

## Custom loggers

Beyond the built-in default logger, you can implement the `IPubnubLoggerInterface` to route logs to external monitoring services, files, or analytics platforms.

### IPubnubLoggerInterface

The `IPubnubLoggerInterface` is a Blueprintable Unreal Interface that defines the logging contract. You can implement it in C++ or Blueprints:

```cpp
class IPubnubLoggerInterface
{
public:
    // Common entry point called for all log messages
    void Log(const FPubnubLogMessage& LogMessage);

    // Level-specific entry points
    void LogTrace(const FPubnubLogMessage& LogMessage);
    void LogDebug(const FPubnubLogMessage& LogMessage);
    void LogInfo(const FPubnubLogMessage& LogMessage);
    void LogWarning(const FPubnubLogMessage& LogMessage);
    void LogError(const FPubnubLogMessage& LogMessage);

    // Log level control
    void SetMinimumLogLevel(EPubnubLogLevel InLevel);
    EPubnubLogLevel GetMinimumLogLevel() const;
    void SetMinimumCCoreLogLevel(EPubnubLogLevel InLevel);
    EPubnubLogLevel GetMinimumCCoreLogLevel() const;
};
```

The SDK calls both the common `Log()` method and the level-specific method (for example, `LogDebug()`) for each message. The log manager checks each logger's minimum levels before dispatching. You only need to implement the methods you plan to use.

### UPubnubBaseLogger

The SDK provides `UPubnubBaseLogger`, a `UObject`-based class that implements `IPubnubLoggerInterface` with default no-op behavior. Extend this class to create custom loggers without implementing every method:

```cpp
UCLASS(BlueprintType, Blueprintable)
class UPubnubBaseLogger : public UObject, public IPubnubLoggerInterface
{
    // ...

protected:
    // Override these defaults in your subclass
    EPubnubLogLevel MinimumLogLevel = EPubnubLogLevel::PLL_Warning;
    EPubnubLogLevel MinimumCCoreLogLevel = EPubnubLogLevel::PLL_None;
};
```

The built-in `UPubnubDefaultLogger` extends `UPubnubBaseLogger` and overrides the `Log()` method to format messages and route them to `UE_LOG`:

* Trace, Debug, and Info messages use `UE_LOG(PubnubLog, Log, ...)`
* Warning messages use `UE_LOG(PubnubLog, Warning, ...)`
* Error messages use `UE_LOG(PubnubLog, Error, ...)`

### Register a custom logger

Create a logger object at runtime and register it with a PubNub client using `AddLogger()`.

:::tip Reference code
Set up your Unreal project and follow the instructions in the lines marked with
ACTION REQUIRED
before running the code.
:::

##### Actor.h

```cpp
#include "PubnubClient.h"

UFUNCTION(BlueprintCallable, Category = "Pubnub|Samples|Configuration")
void AddLoggerSample();
```

##### Actor.cpp

```cpp
// ACTION REQUIRED: Replace ASample_Configuration with name of your Actor class
void ASample_Configuration::AddLoggerSample()
{
	// snippet.hide
	UPubnubClient* PubnubClient = GetPubnubClient();
	// snippet.show

	//Assumes PubnubClient is created and UserID is set

	//Create logger object and register it in PubnubClient
	UPubnubDefaultLogger* CustomLogger = NewObject<UPubnubDefaultLogger>(this);
	if (!CustomLogger)
	{
		UE_LOG(LogTemp, Error, TEXT("Failed to create custom logger."));
		return;
	}

	TScriptInterface<IPubnubLoggerInterface> LoggerInterface;
	LoggerInterface.SetObject(CustomLogger);
	LoggerInterface.SetInterface(Cast<IPubnubLoggerInterface>(CustomLogger));

	PubnubClient->AddLogger(LoggerInterface);
}
```

### List registered loggers

Retrieve all currently registered loggers for a client:

:::tip Reference code
Set up your Unreal project and follow the instructions in the lines marked with
ACTION REQUIRED
before running the code.
:::

##### Actor.h

```cpp
#include "PubnubClient.h"

UFUNCTION(BlueprintCallable, Category = "Pubnub|Samples|Configuration")
void GetLoggersSample();
```

##### Actor.cpp

```cpp
// ACTION REQUIRED: Replace ASample_Configuration with name of your Actor class
void ASample_Configuration::GetLoggersSample()
{
	// snippet.hide
	UPubnubClient* PubnubClient = GetPubnubClient();
	// snippet.show

	//Assumes PubnubClient is created and UserID is set

	TArray<TScriptInterface<IPubnubLoggerInterface>> Loggers = PubnubClient->GetLoggers();
}
```

### Remove a logger

Remove a specific logger from a client:

:::tip Reference code
Set up your Unreal project and follow the instructions in the lines marked with
ACTION REQUIRED
before running the code.
:::

##### Actor.h

```cpp
#include "PubnubClient.h"

UFUNCTION(BlueprintCallable, Category = "Pubnub|Samples|Configuration")
void RemoveLoggerSample();
```

##### Actor.cpp

```cpp
// ACTION REQUIRED: Replace ASample_Configuration with name of your Actor class
void ASample_Configuration::RemoveLoggerSample()
{
	// snippet.hide
	UPubnubClient* PubnubClient = GetPubnubClient();
	// snippet.show

	//Assumes PubnubClient is created and UserID is set

	TArray<TScriptInterface<IPubnubLoggerInterface>> Loggers = PubnubClient->GetLoggers();

	//Remove the first registered logger
	PubnubClient->RemoveLogger(Loggers[0]);
}
```

### Remove all loggers

Remove all registered loggers from a client:

:::tip Reference code
Set up your Unreal project and follow the instructions in the lines marked with
ACTION REQUIRED
before running the code.
:::

##### Actor.h

```cpp
#include "PubnubClient.h"

UFUNCTION(BlueprintCallable, Category = "Pubnub|Samples|Configuration")
void ClearLoggersSample();
	
```

##### Actor.cpp

```cpp
// ACTION REQUIRED: Replace ASample_Configuration with name of your Actor class
void ASample_Configuration::ClearLoggersSample()
{
	// snippet.hide
	UPubnubClient* PubnubClient = GetPubnubClient();
	// snippet.show

	//Assumes PubnubClient is created and UserID is set

	//Clear all registered loggers
	PubnubClient->ClearLoggers();
}
```

## Logged information

The SDK logs information at various stages of operation. This provides visibility into SDK behavior from both the UE SDK and C-Core layers.

### UE SDK logs

The UE SDK layer logs the following at the `Debug` level:

* User-provided input data for each API call (channel names, messages, timetokens, filter expressions)
* Configuration property values at initialization
* Operation results and status codes

### C-Core logs

The C-Core layer provides detailed protocol-level logging:

* Network requests: URL, query parameters, and request details
* Network responses: URL, HTTP status code, and response content
* Errors: Error code, error message, and optional details
* Structured objects: Internal state and complex data as formatted key-value pairs

C-Core logs are particularly useful for diagnosing connectivity issues and understanding the exact data flowing between your application and PubNub servers.

## Viewing logs

Logs generated by the PubNub Unreal SDK can be viewed in:

* Unreal Editor's Output Log window during development (Window > Developer Tools > Output Log).
* Debug console when running a packaged game with the console enabled.
* Log files located in your project's Saved/Logs directory.

Filter the Output Log by the `PubnubLog` category to isolate PubNub SDK messages from other engine output.

## Best practices

### Choose the right log level

| Environment | Recommended UE SDK level | Recommended C-Core level |
| --- | --- | --- |
| Production | `PLL_Warning` or `PLL_Error` | `PLL_None` |
| Staging | `PLL_Info` | `PLL_Warning` |
| Development | `PLL_Debug` | `PLL_Warning` |
| Deep troubleshooting | `PLL_Trace` | `PLL_Debug` |

### Disable C-Core logging in production

C-Core logs at `Debug` and `Trace` levels generate significant output, especially for applications with many API calls. Keep `DefaultLoggerMinCCoreLevel` set to `PLL_None` in production to minimize performance impact and log noise.

### Use custom loggers for monitoring

Implement `IPubnubLoggerInterface` to route critical errors to external monitoring services without affecting the default `UE_LOG` output. Extend `UPubnubBaseLogger` and override the `Log()` method to forward structured `FPubnubLogMessage` data to your monitoring backend. See [Register a custom logger](#register-a-custom-logger) for a complete example of creating and registering a logger.

### Provide complete logs to support

When reporting issues to [PubNub support](https://support.pubnub.com/):

1. Set `DefaultLoggerMinLevel` to `PLL_Debug` or `PLL_Trace`.
2. Set `DefaultLoggerMinCCoreLevel` to `PLL_Debug`.
3. Reproduce the issue.
4. Collect logs from SDK initialization through the problem occurrence.
5. Include the PubNub SDK version and Unreal Engine version.