Vercel provides several logging options available for both Deployment Builds and Serverless Function executions. They can be accessed by selecting either "View Build Logs" or "View Function Logs" from the Project View.
Besides on the Project View, the Build and Function Logs can also be accessed directly on the Deployment View too.
Build logs are generated at Build time for all Deployments. It's similar to the output of your framework's Build Command, with a few minor additions from the Vercel Build system. Once a Build has completed, no further logs will be added to this page.
If any errors or warnings are present in the Build logs, these will be highlighted with different colors (e.g. yellow for warnings, red for errors). This helps you easily identify the cause of any failed Builds and areas you may wish to investigate further.
Build logs are stored indefinitely on each Deployment.
Function logs provide logging output for your Serverless Functions. This includes user logging such as
console.log, along with details of the request made to the Serverless Function.
All function logs are generated on-demand. This means they are only sent to the Serverless Function logs page while it is open in the browser and arrive as each Serverless Function is executed.
Function logs are not stored and will be lost as soon as the Serverless Functions logs page is navigated away from. Requests to cache or static assets are also not stored and never shown. The only exception to this are the failed invocations of Serverless Functions. Those are always persisted.
You can access the Serverless Functions logs page either from the Project View by clicking on the "View Function Logs" button or from the Deployment View by clicking on the "Functions" tab.
On this page you can view the realtime logs of the Serverless Functions in your Deployment. You can also filter them by a specific Serverless Function.
More detailed logs can be activated by clicking on the "Show Details" button.
There are several fields describing every incoming request to the Serverless Function:
- Status: The HTTP response status code.
- Duration: The time it took the Serverless Function to execute.
- Init Duration: The time it took the Serverless Function to boot up when it's "cold". If the Serverless Function is "hot" then Init Duration will be
- Memory Used: The amount of allocated memory to run the Serverless Function.
- ID: Unique ID assigned to this Serverless Function.
- User Agent: The User Agent request header.
The Vercel platform, by default, stores failed invocations from Serverless Functions (when the Serverless Function throws an error), and Build logs are stored indefinitely. To store all runtime logs for Serverless Functions with Vercel, we recommend taking advantage of Log Drains through 3rd-party solutions.
There are several 3rd-party Log Drain Integrations from our Integrations Marketplace that are ready to integrate with Vercel:
Directions on how to set up these Integrations can be found within the Integration Guide links or are provided as part of the installation process.
If the Log Drain Integration you are looking for is not available, please submit feedback as described here.