Logging for Unreal SDK
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.
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'sUE_LOGsystem, which outputs to the Output Log and log files. - Custom loggers: You can add custom logger implementations via the
IPubnubLoggerInterfaceinterface to route logs to external systems. - Structured logging: Every log entry is an
FPubnubLogMessagestruct 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 or 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. |
Reference code
ACTION REQUIRED before running the code.Actor.h
1
Actor.cpp
1
Change log levels at runtime
You can retrieve registered loggers and adjust their minimum levels at any point after initialization.
Reference code
ACTION REQUIRED before running the code.Actor.h
1
Actor.cpp
1
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:
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:
1class IPubnubLoggerInterface
2{
3public:
4 // Common entry point called for all log messages
5 void Log(const FPubnubLogMessage& LogMessage);
6
7 // Level-specific entry points
8 void LogTrace(const FPubnubLogMessage& LogMessage);
9 void LogDebug(const FPubnubLogMessage& LogMessage);
10 void LogInfo(const FPubnubLogMessage& LogMessage);
11 void LogWarning(const FPubnubLogMessage& LogMessage);
12 void LogError(const FPubnubLogMessage& LogMessage);
13
14 // Log level control
15 void SetMinimumLogLevel(EPubnubLogLevel InLevel);
show all 19 linesThe 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:
1UCLASS(BlueprintType, Blueprintable)
2class UPubnubBaseLogger : public UObject, public IPubnubLoggerInterface
3{
4 // ...
5
6protected:
7 // Override these defaults in your subclass
8 EPubnubLogLevel MinimumLogLevel = EPubnubLogLevel::PLL_Warning;
9 EPubnubLogLevel MinimumCCoreLogLevel = EPubnubLogLevel::PLL_None;
10};
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().
Reference code
ACTION REQUIRED before running the code.Actor.h
1
Actor.cpp
1
List registered loggers
Retrieve all currently registered loggers for a client:
Reference code
ACTION REQUIRED before running the code.Actor.h
1
Actor.cpp
1
Remove a logger
Remove a specific logger from a client:
Reference code
ACTION REQUIRED before running the code.Actor.h
1
Actor.cpp
1
Remove all loggers
Remove all registered loggers from a client:
Reference code
ACTION REQUIRED before running the code.Actor.h
1
Actor.cpp
1
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 for a complete example of creating and registering a logger.
Provide complete logs to support
When reporting issues to PubNub support:
- Set
DefaultLoggerMinLeveltoPLL_DebugorPLL_Trace. - Set
DefaultLoggerMinCCoreLeveltoPLL_Debug. - Reproduce the issue.
- Collect logs from SDK initialization through the problem occurrence.
- Include the PubNub SDK version and Unreal Engine version.