From the course: Node.js: Debugging and Performance Tuning
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Why and what should I log?
From the course: Node.js: Debugging and Performance Tuning
Why and what should I log?
- [Narrator] What is a log? No, not the wood kind. A log is a record of events and messages between systems. They're used to understand what's happening on a system and define problems. Sounds like a great idea. Let's see how our rock, paper, scissors game logs. Open up Visual Studio Code, then the terminal. Let's take a look at our log files. Type PM2 space logs and press Enter. Well, that's underwhelming. In fact, other than start up messages from PM2, there aren't any logs. Let's open up a browser and arrange the window so we can see both. Great, let's start a game. Navigate to local host port 5000 and then click Start New. Make a choice. Awesome. Over on the left, what's going on on our log files? Well, nothing. That's not particularly useful. Alright, let's trigger an error. Instead of games one, let's go to games asdf. Now what's in the log? An error, now we're getting somewhere, or are we? Looking at this error, can you tell me how to make this error happen again? Well, there's…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
(Locked)
Why and what should I log?6m 26s
-
Problems with Node.js console6m 1s
-
(Locked)
Implementing Express error pages6m 48s
-
(Locked)
Choosing a logging library5m 40s
-
(Locked)
Adding Winston for Node logging4m 41s
-
(Locked)
Request logging with Morgan6m 39s
-
(Locked)
Correlating requests in logs6m 18s
-
(Locked)
Cross-application request correlation5m 32s
-
(Locked)
Challenge: Cross-application request IDs2m 14s
-
(Locked)
Solution: Cross-application request IDs9m 30s
-
(Locked)
-
-
-