Source: https://developers.woosmap.com/products/geofencing-sdk/android-sdk/guides/debug-log/

> For clean Markdown of any page, append `.md` to the page URL.

> For a complete documentation index, see https://developers.woosmap.com/llms.txt

# Activate Debug Logs



In some cases, in order to identify the source of an issue, we require Geofence SDK logs from your app. These logs are used for reporting events from our SDK which are useful when debugging and troubleshooting how our code is behaving in your app. 

Logs must be enabled within your App Code as part of SDK implementation. For this reason, we recommend using a non-production app to troubleshoot

## Activate Logs

Find the Implementation details for enabling logging required by support below.

In SDK log level defaults to `DEBUG` but you can easily change it by setting `setLogLevel` property of SDK. 

Following code will show all the `DEBUG` and above logs in the logcat.

```` java
woosmap.getLogger().setLogLevel(Logger.DEBUG);
````

By default SDK logs all the warnings and errors in persistent files which reside within the application's data directory. By default, the SDK will remove files that are older than 7 days.

If you wish to store persistent log level, you can set `setRetainedLogLevel` property of the logger.

```java
this.woosmap.getLogger().setRetainedLogLevel(Logger.DEBUG);
```

To change persistent log retention period you can set `setLogRetentionDays` property of the logger.

```java
this.woosmap.getLogger().setLogRetentionDays(7);
```

To retrieve the logs, invoke `readLogs` method of the logger.

```java
woosmap.getLogger().readLogs(getApplicationContext(), new Logger.ReadLogsListener() {
                @Override
                public void onLogsReady(StringBuilder logs) {
                    logs.toString();
                }
            });
```

## Different Log Levels

* **`ERROR`** - Log error messages. Used for critical errors, parse exceptions, and other situations that cannot be gracefully handled.

* **`WARN`** - Log error messages. Used for API deprecations, invalid setup, and other potentially problematic situations.

* **`DEBUG`** - Log debugging messages. Used for reporting general SDK status with more detailed information.

* **`INFO`** - Log informative messages. Used for reporting general SDK status.

* **`VERBOSE`** - Log granular informative messages. Used for a  detailed level of logs.
