1
00:00:00,460 --> 00:00:06,730
In this video, we are going to see logs of a lambda function with a list measurement console.

2
00:00:07,450 --> 00:00:11,230
So here you can find our lambda function in the code window.

3
00:00:11,740 --> 00:00:16,690
We have a indexes and in indexes we have actual lambda function codes.

4
00:00:16,750 --> 00:00:22,070
So let's examine this code and understand how we can look in our lambda function.

5
00:00:22,090 --> 00:00:25,570
So in the handle method, we basically have two parameters.

6
00:00:25,570 --> 00:00:30,100
The first one, which is event, which comes from the JSON object.

7
00:00:30,130 --> 00:00:31,960
The second one is the context.

8
00:00:32,290 --> 00:00:39,540
So we are signing the event JSON object and after that in the method body, we perform some actions.

9
00:00:39,550 --> 00:00:43,730
So we have three actions which regarding to logging.

10
00:00:43,750 --> 00:00:51,260
So we basically write the log with console log method and we are writing the logs value 1 to 3 as a

11
00:00:51,310 --> 00:00:53,320
even third key 1 to 3.

12
00:00:53,470 --> 00:01:00,880
So these are the logging operations into our lambda function and after that we are return make the event

13
00:01:00,880 --> 00:01:02,050
that key one.

14
00:01:02,920 --> 00:01:09,290
So basically we can write the logs on the Amazon clockwise log with these methods.

15
00:01:09,310 --> 00:01:14,500
So let's start the test and see how we can see on the Amazon cloud which log.

16
00:01:14,710 --> 00:01:20,080
So basically, as you remember that in the test section, we have created a test template.

17
00:01:20,080 --> 00:01:27,430
So that's why we can directly click this test button or click this icon and see this is the our saved

18
00:01:27,430 --> 00:01:29,270
payload before we start.

19
00:01:29,290 --> 00:01:32,210
So let me click the test button and see what's happened.

20
00:01:32,230 --> 00:01:37,720
So basically it is like the test invoke our lambda function and see the execution result on the code

21
00:01:37,720 --> 00:01:43,570
window and you can see the test event name in here and response as a value one because we are sending

22
00:01:43,570 --> 00:01:47,560
the JSON object as a value one.

23
00:01:47,590 --> 00:01:54,700
But also in the function logs, we can see the cloud which logs in this window basically is the start

24
00:01:54,700 --> 00:02:00,040
request ID and these are the three lines of logging or operations.

25
00:02:00,760 --> 00:02:06,760
So if you open the index case, you can see in here we basically logging with these codes and these

26
00:02:06,760 --> 00:02:11,680
logs seen in the Amazon cloud logs as a info log what you want to three.

27
00:02:12,010 --> 00:02:18,010
After that you can see the request and the result of the request with including the duration, billing,

28
00:02:18,010 --> 00:02:19,120
duration and so on.

29
00:02:19,270 --> 00:02:27,070
So this is the logging operation in our Lambda function code and we can also test the same method with

30
00:02:27,070 --> 00:02:27,970
the test window.

31
00:02:28,000 --> 00:02:34,060
If you click the test window, we can see that our event has an object and event name in here.

32
00:02:34,090 --> 00:02:39,130
If you change this key one let's say is the test one.

33
00:02:39,280 --> 00:02:43,630
And if you're going to save and test this template again.

34
00:02:44,490 --> 00:02:47,670
This time, we will see that in the execution result.

35
00:02:47,700 --> 00:02:52,860
If you expand this detail, you can see that the return back to test one and if you scroll down, you

36
00:02:52,860 --> 00:02:54,960
can see the logs output in here.

37
00:02:55,080 --> 00:02:58,830
We can see the first output is changed to test one.

38
00:02:58,950 --> 00:03:05,040
So I would like to also check from the Amazon cloud looks for that action.

39
00:03:05,040 --> 00:03:11,340
You can click this load button and see the logs from the Amazon Cloud Watch logs.

40
00:03:11,730 --> 00:03:16,860
So if you come here and you can see the logs, it streams of our function in here.

41
00:03:16,860 --> 00:03:22,220
If you click the latest log stream, you can see that we have invoked lambda function two times.

42
00:03:22,230 --> 00:03:28,490
The first time is the logs come here and the second time we changed the, the incoming evaluation is

43
00:03:28,500 --> 00:03:32,910
a test one and we saw the logging changed is the same way.

44
00:03:33,120 --> 00:03:37,140
So these are the logging and testing our lambda functions.

45
00:03:38,090 --> 00:03:44,300
You can see that the summary of the lambda function tests on the test section and also in the code section,

46
00:03:44,300 --> 00:03:49,550
we can detect the test and invoke see execution result and also we can see the logs from the Amazon

47
00:03:49,550 --> 00:03:50,400
cloud shows.

48
00:03:50,720 --> 00:03:56,120
So logging is very important when it comes to develop our application fully serverless.

49
00:03:56,120 --> 00:04:01,880
So we need to understand how logging and tracing our application in locations with using Amazon cloud

50
00:04:02,060 --> 00:04:02,600
logs.
