---
title: Generate trace log for troubleshooting (Node.js)
source: https://docs.newrelic.com/docs/apm/agents/nodejs-agent/troubleshooting/generate-trace-log-troubleshooting-nodejs
---

Your New Relic [Node.js agent log](https://docs.newrelic.com/docs/apm/agents/nodejs-agent/installation-configuration/nodejs-agent-configuration/#logging_config) captures errors at the default `info` level. However, when troubleshooting or debugging, generate a more verbose `trace` log to help find and investigate problems.

> #### ⚠️ IMPORTANT
>
> The `trace` log setting is a highly verbose logging level. To reduce disk space consumption, return the `logging : {level}` section to its [original setting](https://docs.newrelic.com/docs/apm/agents/nodejs-agent/installation-configuration/nodejs-agent-configuration/#logging_config) after testing.

## Generate log files [#create]

To generate the detailed `trace` log file:

1.  Edit your `newrelic.js` file and change the `logging` section's `level` to `trace`. If using environment variables (with Lambda, this is the most common way), set the `NEW_RELIC_LOG_LEVEL` to `trace`.

    ```js
    logging: {
      level: 'trace'
    }
    ```
2.  Restart Node.
3.  Exercise your web application for about five minutes to generate sufficient logging data.
4.  After testing, change the `level` to a less verbose [logging level](https://docs.newrelic.com/docs/apm/agents/nodejs-agent/installation-configuration/nodejs-agent-configuration/#log_level), such as `info` (default).
5.  Open and examine the generated log file.

If you're using Lambda, [learn how to set up logs](https://docs.newrelic.com/docs/serverless-function-monitoring/aws-lambda-monitoring/troubleshooting/troubleshoot-enabling-serverless-monitoring-aws-lambda/#attach-logs).

## Examine log file [#logfile]

By default, the Node.js agent [stores the log file](https://docs.newrelic.com/docs/apm/agents/nodejs-agent/installation-configuration/nodejs-agent-configuration/#log) in the current working directory as `newrelic_agent.log`. If the log file or folder are not visible:

1.  Check whether you have set the logging path to `stdout` or `stderr`.
2.  Verify that the current working directory is the same as the directory where you expect the log file to be located.
