Logging
On this page
You can set or change your app's log level when developing or debugging your app. You might want to change the log level to log different amounts of data depending on your development needs. You can specify different log levels or custom loggers.
Set or Change the Log Level
You can set the level of detail reported by Atlas Device SDK.
You can change the log level to increase or decrease verbosity at different points in your code.
Customize the Logger
You can create a custom logger. You might want to customize logging to add specific tags or set specific log levels during development, testing, or debugging.
Tip
To diagnose and troubleshoot errors while developing your application, set the
log level to debug
or trace
. For production deployments, decrease the
log level for improved performance.
Turn Off Logging
You can turn off logging by setting the log level:
Other Loggers
The C++ and Java SDKs have additional loggers that behave differently than the other examples on this page.
C++ SDK
The C++ SDK uses a sync logger that behaves differently than the rest of the examples on this page. You can set or change your sync client's log level to develop or debug your application. You might want to change the log level to log different amounts of data depending on the app's environment.
You can set the level of detail reported by the sync client logger to
specify the level of output you want from the sync client. Get
an instance of an App's sync manager,
and pass a realm::logger::level
to the set_log_level()
member function:
auto logLevel = realm::logger::level::info; app.get_sync_manager().set_log_level(logLevel);
Java SDK
The SDK logs events to the Android system log automatically. You can view these events using Logcat.
We recommend using the Kotlin SDK to get the latest logging updates, like changing the log level at different points in your code.
The Java SDK uses the log levels defined by Log4J. To configure the log level for database logs in your application, pass a LogLevel to RealmLog.setLevel():
RealmLog.setLevel(LogLevel.ALL);