---
title: How to enable debug logs
description: Enable debug logs for each SuperTokens component to troubleshoot your integration.
sidebar:
  order: 2
---

## Backend logs

:::note[This is only available on versions:]
- SuperTokens-node >= v9.1.2
- SuperTokens-golang >= v0.5.5
- SuperTokens-python >= v0.6.3
:::

Our backend SDK provides useful logs that can help with debugging.
To enable logging, you need to set the debug setting to `true` in the `init` function call:

<CodeGroup group="backend-language">
<Tab title="Node.js" value="nodejs">
```tsx
import supertokens from "supertokens-node";

supertokens.init({
  debug: true,
  supertokens: {
    connectionURI: "...",
  },
  appInfo: {
    apiDomain: "...",
    appName: "...",
    websiteDomain: "...",
  },
  recipeList: [
    /*...*/
  ],
});
```
</Tab>
<Tab title="Go" value="go">
```go
import "github.com/supertokens/supertokens-golang/supertokens"

func main() {
    supertokens.Init(supertokens.TypeInput{
        Debug: true,
        Supertokens: &supertokens.ConnectionInfo{
            ConnectionURI: "...",
            APIKey:        "...",
        },
    })
}

```
</Tab>
<Tab title="Python" value="python">
```python
from supertokens_python import init, InputAppInfo, SupertokensConfig

init(
    debug=True,
    app_info=InputAppInfo(api_domain="...", app_name="...", website_domain="..."),
    supertokens_config=SupertokensConfig(
       connection_uri='...',
       api_key='...'
    ),
    framework='flask', 
    recipe_list=[
       #...
    ]
)
```
</Tab>
</CodeGroup>

Logs on your terminal have the following shape:
```bash
com.supertokens {"t": "2022-04-09T08:44:49.057Z", "sdkVer": "...", "message": "Started SuperTokens with debug logging (supertokens.init called)", "file": "..."}
```

- `t`: The time the log generated
- `sdkVer`: Version of the SDK you are using
- `message`: The log message
- `file`: The file and line number from where this log originated.

## Frontend logs

Add `enableDebugLogs` when calling the `init` function:

<UITypeSwitch />

<VariantContent storageKey="ui-type" value="prebuilt">

<DependentContent passive group="frontend-prebuilt-ui">
<ContentOption title="Angular" value="angular">
You need to make changes to the auth route configuration, as well as to the `supertokens-web-js` SDK configuration at the root of your application:
</ContentOption>
</DependentContent>

<CodeGroup group="frontend-prebuilt-ui">
<Tab title="Reactjs" value="reactjs">
```tsx check=false reason="initialization excerpt omits required application and recipe configuration"
import React from "react";
import SuperTokens from "supertokens-auth-react";

SuperTokens.init({
  enableDebugLogs: true,
  appInfo: {
    /*...*/
  },
  recipeList: [
    /*...*/
  ],
});
```
</Tab>
<Tab title="Angular" value="angular">
```tsx check=false reason="Angular auth route provides the pre-built UI global at runtime"
// this goes in the auth route config of your frontend app (once the pre-built UI script has been loaded)

supertokensUIInit({
  enableDebugLogs: true,
  appInfo: {
    /*...*/
  },
  recipeList: [
    /*...*/
  ],
});
```
</Tab>
</CodeGroup>

<DependentContent passive group="frontend-prebuilt-ui">
<ContentOption title="Angular" value="angular">
This change goes in the `supertokens-web-js` SDK configuration at the root of your application:
</ContentOption>
</DependentContent>

<CodeGroup passive group="frontend-prebuilt-ui">
<Tab title="Angular" value="angular">
```tsx
import SuperTokens from "supertokens-web-js";
import Session from "supertokens-web-js/recipe/session";

SuperTokens.init({
  appInfo: {
    apiDomain: "...",
    appName: "...",
  },
  recipeList: [Session.init()],
  enableDebugLogs: true,
});
```
</Tab>
</CodeGroup>

</VariantContent>

<VariantContent storageKey="ui-type" value="custom">



<DependentContent passive group="frontend-custom-ui">
<ContentOption title="Mobile" value="mobile">
<DependentContent passive group="mobile-frameworks">
<ContentOption title="Android" value="android">
:::warning[Debug logs feature not yet available for Android]
:::
</ContentOption>
<ContentOption title="iOS" value="ios">
:::warning[Debug logs feature not yet available for iOS]
:::
</ContentOption>
</DependentContent>
</ContentOption>
</DependentContent>

<CodeGroup group="frontend-custom-ui">
<Tab title="Web" value="web">
<DependentContent group="install-method" label="Installation method">
<ContentOption title="npm" value="npm">
```tsx
import SuperTokens from "supertokens-web-js";
import Session from "supertokens-web-js/recipe/session";

SuperTokens.init({
  appInfo: {
    apiDomain: "...",
    appName: "...",
  },
  recipeList: [Session.init()],
  enableDebugLogs: true,
});
```
</ContentOption>
<ContentOption title="Script tag" value="script-tag">
```tsx check=false reason="script-tag installation provides SuperTokens globals at runtime"
supertokens.init({
  appInfo: {
    apiDomain: "...",
    appName: "...",
  },
  recipeList: [supertokensSession.init()],
  enableDebugLogs: true,
});
```
</ContentOption>
</DependentContent>
</Tab>
<Tab title="Mobile" value="mobile">
<DependentContent group="mobile-frameworks" label="Mobile framework">
<ContentOption title="ReactNative" value="reactnative">
```tsx
import SuperTokens from "supertokens-react-native";

SuperTokens.init({
  apiDomain: "...",
  enableDebugLogs: true,
});
```
</ContentOption>
<ContentOption title="Flutter" value="flutter">
```dart
import 'package:supertokens_flutter/supertokens.dart';

void main() {
  SuperTokens.init(apiDomain: "...", enableDebugLogs: true);
}
```
</ContentOption>
<ContentOption title="Android" value="android">

</ContentOption>
<ContentOption title="iOS" value="ios">

</ContentOption>
</DependentContent>
</Tab>
</CodeGroup>

<DependentContent passive group="frontend-custom-ui">
<ContentOption title="Web" value="web">
The above prints out SuperTokens debug log on the browser console:

<img src="/docs-assets/img/front-debug-logs.png" alt="Frontend browser debug logs" />
</ContentOption>
<ContentOption title="Mobile" value="mobile">
<DependentContent passive group="mobile-frameworks">
<ContentOption title="ReactNative" value="reactnative">
The above prints out SuperTokens debug logs on the terminal if you're using the React Native CLI or Expo:

<img src="/docs-assets/img/react-native-debug-logs.png" alt="React Native debug logs" />
</ContentOption>
<ContentOption title="Flutter" value="flutter">
The above prints out SuperTokens debug logs on the terminal:

<img src="/docs-assets/img/flutter-debug-logs.png" alt="Flutter debug logs" />
</ContentOption>
</DependentContent>
</ContentOption>
</DependentContent>



</VariantContent>


## SuperTokens core logs


If you want to change the log levels, you can set the core's `log_level` configuration to reflect this:
- `DEBUG`: Prints out all the log levels
- `INFO`: Prints out `INFO`, `WARN` and `ERROR` levels
- `WARN`: Prints out `WARN` and `ERROR` levels
- `ERROR` Prints out `ERROR` levels
- `NONE`: No logs output

By default, the core prints out `INFO`, `WARN`, and `ERROR` logs.

<CodeGroup group="docker">
<Tab title="With Docker" value="with-docker">
```bash
 docker run \
    -p 3567:3567 \
    -e LOG_LEVEL=DEBUG \ 
    -d supertokens/supertokens-<db_name>
```
</Tab>
<Tab title="Without Docker" value="without-docker">
```yaml
# You need to add the following to the config.yaml file.
# The file path can be found by running the "supertokens --help" command

log_level: "DEBUG"
```
</Tab>
</CodeGroup>
