Skip to main content

How to enable debug logs

Backend logs

important

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:

import supertokens from "supertokens-node";

supertokens.init({
debug: true,
supertokens: {
connectionURI: "...",
},
appInfo: {
apiDomain: "...",
appName: "...",
websiteDomain: "..."
},
recipeList: [/*...*/]
});

Logs on your terminal have the following shape:

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:

What type of UI are you using?

import React from 'react';
import SuperTokens from "supertokens-auth-react";

SuperTokens.init({
enableDebugLogs: true,
appInfo: { /*...*/ },
recipeList: [/*...*/]
});

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.

 docker run \
-p 3567:3567 \
// highlight-next-line
-e LOG_LEVEL=DEBUG \
-d registry.supertokens.io/supertokens/supertokens-<db_name>

We use cookies and similar technologies to help personalize content, analyze site usage, and provide a better experience. By clicking "Accept" you consent to our use of cookies. Visit our Privacy Policy for more information.