Logging practices

Logging is essential for development and operations. It helps you monitor real time activity and find issues. Turn logging on to see your app’s behavior. Use logs to keep audit trails for security and compliance.

The PubNub SDKs include logging. You can turn it on and choose a log level in config.

These options apply to all SDKs. For platform steps, see each SDK’s Logging guide, such as the JavaScript SDK.

Logging options

Here’s an overview of the available SDK logging options:

  • Configuration options: Turn logging on with SDK config properties (for example, logVerbosity).

  • Log levels: Choose a log level (debug, info, warn, error) to control detail and filter messages.

  • Output destinations: Send logs to the console or files. Or send them to custom places, like databases or monitoring services, using supported logging libraries.

  • Custom logging: Add custom loggers or handlers. Use SDK hooks to route logs to databases or other storage.

  • Standard libraries: Some SDKs use standard libraries (for example, SLF4J). This lets you integrate with frameworks such as Log4j.

Last updated on
On this page