How do you look at console.log output of the amazon lambda function

前端 未结 4 2267
太阳男子
太阳男子 2021-02-12 09:45

When you do a

console.log(\'Loading function\');

in an amazon lambda function, where does that go?

My setup api gateway lambda functio

4条回答
  •  攒了一身酷
    2021-02-12 10:36

    There are 2 ways to access logs of your Lambda Function.

    Method 1 (Using Serverless CLI):

    Navigate to the root of your project folder and enter this in your command line:

    sls logs -f myFunctionName -t
    

    -f is for specifying the function name and -t is live tailing the logs in the command line.

    Method 2 (Using CloudWatch Logs):

    Go to CloudWatch in the region where your function was deployed and head to Logs. You will find the logs of your function there.

提交回复
热议问题