Automatically translated.View original post

What are the Logs?

What are Logs? And why is it important for Basic Programming?

Have you ever had a problem with a program and don't know what's going on? 🤔 Have to guess where it is, wasting hours!

Logs are "evidence" that helps us to stop guessing when a program has a problem. It's like a notebook that records everything a program does. When a problem occurs, just open it and know where to solve it!

Logs severity level:

- DEBUG: Details for programming people

- INFO: The usual thing to tell.

- WARNING: There's a problem, but it's still fine.

- ERROR: There's a real problem. Partially unavailable.

- CRITICAL: The system's broken.

How are prints and Logs different?

- Print: It's like writing on a note, pasting a screen. Turn off the program, the text is gone.

- Logs: It's like writing down a notebook with a date. Keep it looking backwards.

Good Logs Must Answer These 4 Questions:

1. When: Happened? (Timestamp)

2. What: How violent is the level? (Level)

3. Where: What part of the code is born? (Function, Module)

4. Why: Why is it born? Does it contain information? (UserID, OrderID)

Popular Logging Libraries:

- Python: logging, loguru.

- JavaScript: winston, pino

- Java: log4j, slf4j

- C #: Serilog, NLog

- PHP: Monolog

- Go: logrus, zap.

Interesting Logs Viewing Tool:

- Command line: grep, tail, less.

- Log management: ELK Stack, Splunk

- IDE integration: VS Code extensions

- Cloud services: AWS CloudWatch, Google Cloud Logging

Good Logs need to read and know about immediately. Don't need to sit down to code! Try Improving Writing Logs ensure that the programmer's life will definitely improve.

# Programming # logs # debugging # softwaredevelopment # Basicprogramming

2025/12/6 Edited to

... Read moreถ้าคุณค้นว่า “logs แปลว่า” หรือพิมพ์ผิดเป็น “loags” แล้วเจอบทความนี้ ความหมายแบบสั้นที่สุดคือ: log (เอกพจน์) แปลว่า “บันทึก” ส่วน logs (พหูพจน์) คือ “บันทึกหลายรายการ” หรือ “บันทึกเหตุการณ์” ที่ระบบ/โปรแกรมจดไว้ให้เราเปิดย้อนดูได้ ในชีวิตจริง Logs เหมือน “สมุดบันทึกพร้อมวันเวลา” หรือบางคนชอบเปรียบเป็นกล่องดำ (flight recorder) ของระบบ: ตอนทุกอย่างปกติเราอาจไม่สนใจ แต่พอเกิดปัญหา—ระบบล่ม, ล็อกอินไม่ได้, ชำระเงินไม่ผ่าน—Logs จะเป็นหลักฐานว่าก่อนหน้าเกิดอะไรขึ้นบ้าง และจุดไหนที่พัง หลายคนเริ่มจากการใช้ print เพื่อเช็กค่าตัวแปร ซึ่งไม่ผิดเลยสำหรับงานเล็ก ๆ แต่พอโปรแกรมโตขึ้น print จะเริ่มควบคุมยาก เช่น ข้อความกระจัดกระจาย ไม่มีระดับความสำคัญ ไม่มี timestamp และปิดโปรแกรมแล้วก็หายหรือหาไม่เจอ ต่างจาก Logs ที่ออกแบบมาเพื่อ “บันทึกอย่างเป็นระบบ” ตั้งระดับได้ (DEBUG/INFO/WARNING/ERROR/CRITICAL) และส่งออกไปที่ไฟล์/ระบบเก็บ Log/Cloud ได้ ทริคที่เราใช้แล้วช่วยลดเวลางมบั๊กมาก ๆ คือเขียน Logs ให้ตอบ 4 ข้อแบบนี้เสมอ: 1) When: เกิดเมื่อไหร่ (timestamp) 2) What: เหตุการณ์ระดับไหน (level) 3) Where: เกิดที่ฟังก์ชัน/โมดูลไหน 4) Why: มีบริบทอะไรบ้าง เช่น userId, orderId, ip, payload ที่จำเป็น ตัวอย่างที่เจอบ่อย: “Login failed” อย่างเดียวอ่านแล้วช่วยไม่ได้เท่าไหร่ แต่ถ้าเป็น “Login failed | userId=123 | reason=wrong_password | ip=1.2.3.4” เราจะเริ่มไล่ถูกจุดทันที (และถ้าเป็นข้อมูลอ่อนไหวก็ต้องระวัง ไม่ควร log รหัสผ่าน/เลขบัตร) ถ้าอยากเริ่มแบบง่าย ๆ ให้เลือก logging library ตามภาษา เช่น Python ใช้ logging หรือ loguru, JavaScript ใช้ winston/pino แล้วตั้ง format ให้มีเวลา+ระดับ+ตำแหน่ง จากนั้นเวลาจะดู Log ก็ใช้คำสั่งพื้นฐานอย่าง tail/grep/less หรือถ้าระบบใหญ่ค่อยต่อไปที่เครื่องมือจัดการ Log เช่น ELK, Splunk หรือบนคลาวด์อย่าง AWS CloudWatch / Google Cloud Logging สรุป: “Logs” แปลว่า “บันทึกเหตุการณ์” และในโลกโปรแกรมมิ่งมันคือเครื่องมือที่ทำให้เราหยุดเดาเวลาเกิดปัญหา—ยิ่งเริ่มเขียน Log ให้ดีตั้งแต่ Basic Programming ชีวิตตอน debug จะง่ายขึ้นแบบรู้สึกได้เลย

Related posts

Can you imagine 💀 Thanks kcon for some cool interactions with artists who are doing their jobs #delulu #kpop #kcon
Natylogs ᵕ̈

Natylogs ᵕ̈

315 likes

What a time to be a Brazilian in K-Pop 😵‍💫 Between what happened to Jungkook and the new Netflix show "My Korean Boyfriend," Brazil is suddenly in the center of some uncomfortable, but much needed conversations about obsessive fan behavior and the fetishization of Asian men. I don't want to off
Natylogs ᵕ̈

Natylogs ᵕ̈

9 likes

The standards are high 💁🏾‍♀️ #btsarmy #btsfanchant
Natylogs ᵕ̈

Natylogs ᵕ̈

32 likes

Army, what bag are we bringing to Tampa for the BTS concerts? Their stadium bag policy is super strict! Also, what’s wrong with BT21??? 😳 #bts #btsworldtour #concertbag #raymondjamesstadium #kpop
Natylogs ᵕ̈

Natylogs ᵕ̈

11 likes

What are you wearing for the BTS tour? 👀 #btsarmy #btstour #kpop #concertoutfit @Viba_me #vibamaxxing
Natylogs ᵕ̈

Natylogs ᵕ̈

31 likes

One of the greatest performers of our generation! J-Hope you are INSANE 🔥🥵 HOPE ON THE STAGE THE MOVIE IS SO MUCH FUN! #jhope #hopeonthestagetour #btsmovie #hopeonthestagemovie #bts
Natylogs ᵕ̈

Natylogs ᵕ̈

68 likes

Get salon-quality nails at home with this JELLOJELLO set 💅✨ Beginner friendly ✔️ No nail damage ✔️ @jellojello Shine with Korea, where beauty innovation meets real stories 🇰🇷💞 #jellojello #gelnailkit #jellojelloonekillgelremover #glowwithkorea #kbeautyglobal
Natylogs ᵕ̈

Natylogs ᵕ̈

1275 likes

Not my Jimin purple hoodie man 😭 Não acredito nisso #jimin #bts #btsmerch
Natylogs ᵕ̈

Natylogs ᵕ̈

306 likes

logs
#logs #fyp
Uziel Rosario

Uziel Rosario

3 likes

Quick and Easy Pizza Logs
Meal Time With Tonya

Meal Time With Tonya

214 likes

Me and my horse love jumping logs in the forest 😎
Me and my horse love jumping logs in the forest 😎 #forest #ai #horsegirl
Horse Riding Vibes

Horse Riding Vibes

7 likes

Yule Logs
she did such a good job. hope everyone has a great solstice! #witchery #solstice #wintersolatice #magic #unfiltered
Sleepy_the_mermage

Sleepy_the_mermage

3 likes

📋Ditch the rules. Journal your way. 📝
Not sure what to write in your journal? It might be because you’re using a style that doesn’t fit you. Here are 5 common journaling styles — and what to try for each one 👇 🧠 The Brain Dumper You write to release. 🛠 Try: Stream-of-consciousness (set a 5-minute timer, go) 🌀 Prompt: What’s takin
Hannah | journal coach

Hannah | journal coach

134 likes

Reading Logs!!
Add me on Goodreads and Fable! #commentbelowgoodbook #kindlegirlie #darkromance #booktok #checkoutmybookshelf
Sky Paris

Sky Paris

4 likes

Logs logs logs. I love logs……..
Don’t be scared of logs. They are very handy to understand. Start by using the basic rules. All engineers need to know this stuff. You will see it in HNC, BTEC, A levels and engineering courses. Perfect for students, apprentices, and anyone who wants mechanical engineering to just make sen
EngineerItWithMJL

EngineerItWithMJL

3 likes

A hand wearing an Oura Ring, with text highlighting its durable titanium material, water resistance, and non-allergenic properties. It also displays a chart showing readiness, resting heart rate, heart rate variability, body temperature, and respiratory rate metrics.
A person taking a mirror selfie, showcasing the Oura Ring's research-grade sensors for tracking health metrics like heart rate, blood oxygen, and temperature. The image lists reasons for purchase, including sleep, stress, and period tracking.
A hand wearing an Oura Ring, illustrating the two main designs: Heritage (plateau) and Horizon (rounded). It notes the ring comes in silver, black, gold, and rose gold, with the displayed ring being a Silver Horizon.
Let’s Talk about the Oura Smart Ring 👇🏻
I wavered purchasing an Oura ring for months!! After my last post debating color options, you all wanted a post about the functions of the ring! Similar to an Apple Watch, the Oura ring counts steps, logs workouts, tracks your BPM, but it has a lot of additional resources. As an individual
cc 🍒🐆🍸🏳️‍🌈

cc 🍒🐆🍸🏳️‍🌈

35 likes

Look what I found at HMart in ktwon LA!! G-Dragon’s PEACEMINUSONE Highball is now available at select locations for a limited time. #hmartfinds #gdragon #peaceminusone #kpopchristmas #peaceminusonehighball
Natylogs ᵕ̈

Natylogs ᵕ̈

6 likes

A golden statue of a man, possibly the Oregon Pioneer, stands on a marble base, partially surrounded by scaffolding against a clear blue sky, hinting at the article's Oregon context.
A man with long reddish hair and blue eyes smiles while holding a metal bowl filled with freshly harvested plums, connecting to the article's themes of harvest and blooming.
A social media post features a metallic sphere-shaped UFO floating in a cloudy sky, with text stating "SPHERE-SHAPED UFO SEEN IN MEXICO," aligning with the article's theme of "the spheres."
🛸✨ The Spheres Are Not Coming—They Are Here 🟠
…and some of us are already dancing with them. It’s not just that the spheres have been spotted. It’s not just that governments are quietly admitting what mystics, experiencers, and farmers have known for centuries. It’s not just that these beings appear in databases, radar logs, sacred carvin
Anthony Kennedy

Anthony Kennedy

3 likes

I build my shelter in the forest
#camping #outdoors
Camping.Logs

Camping.Logs

68 likes

A blue bullet journal covered in various stickers, including Disney, animals, and text like "DCP ALUMNI" and "magic maker." The image has text overlayed that reads "Bujo prompts & ideas."
An open bullet journal spread featuring a "Book mood board/quote log." It contains collaged images, handwritten quotes from books, and notes, with text stating "I love doing these for my 5 star reads!"
An open bullet journal spread titled "A quote paired with a playlist." It features a quote by Taylor Swift, musical notes, floral stickers, and a handwritten playlist of classical and contemporary songs.
What are your go-to bujo spread ideas?
I love bullet journaling but always have the toughest time deciding what to bujo about. Here are some ideas I’ve come up with and come back to because they’re so fun to do and look back on! Book spread: bujoing about books is one of my favorite things to do. From writing reviews to keeping track
Rebecca 📚☕️🎻

Rebecca 📚☕️🎻

13 likes

Logs logs are everywhere……..
Don’t be scared of logs. They are very handy to understand. Start by using the basic rules. All engineers need to know this stuff. You will see it in HNC, BTEC, A levels and engineering courses. Perfect for students, apprentices, and anyone who wants mechanical engineering to just make sen
EngineerItWithMJL

EngineerItWithMJL

2 likes

A person walks on vast sand dunes under a clear sky, with the title text "PLACES IN THE U.S. THAT DON'T FEEL REAL" overlaid, suggesting otherworldly destinations.
Hamilton Pool Preserve in Texas, featuring a jade-green pool beneath a limestone grotto with a waterfall and lush vegetation, under a bright blue sky.
The Bisti/De-Na-Zin Wilderness in New Mexico, showcasing unique, eroded rock formations and hoodoos under a dramatic, colorful sunset sky.
PLACES IN THE U.S. THAT DON’T FEEL REAL
The U.S. is dotted with such magical locations that seem too beautiful to be real. If you're craving a journey to some of these otherworldly destinations, here's a list you should definitely add to your travel bucket list! 🚗🌟 Hamilton Pool Preserve, Texas 🌊🦋 Nestled just outside Austin,
Niki ◡̈ global guru

Niki ◡̈ global guru

995 likes

Cutting a slab into logs
#tallowsoap #soapcutting #cdasoapco
CdA Soap Co

CdA Soap Co

33 likes

Two decorative deer figures crafted from logs and sticks, featuring googly eyes and black noses, stand on a concrete surface with patches of snow in the background.
Deer made out of sticks and logs
Bub’s

Bub’s

35 likes

January habit & spending logs
I've actually been keeping up with my trackers and filling them out! I tried to keep it simple so that I wouldn't feel overwhelmed so my habit categories are: Exercise - bike or yoga Sleep - good or bad Creativity - writing or journaling Tasks - clean or organize On days I do b
The Pen Witch

The Pen Witch

20 likes

Setup Your Digital Planner for the New Year ✨
Here are 5 tips for setting up your digital planner for the new year to maximize productivity and organization: 1. Choose the Right Platform • Select a digital planner app that suits your needs, such as Notion, GoodNotes, Trello, or Google Calendar. • Look for features like syncing across de
Joy 📚

Joy 📚

153 likes

Discover PyreLogs
We’re PyreLogs — the first, reusable campfire bases that increase airflow and prevent collapse. It’s our mission to build better fires, faster.
PyreLogs

PyreLogs

1 like

Petrified Logs
Tina Turns the Page

Tina Turns the Page

1 like

Jeffrey Epstein Flight Logs - 118 Page PDF
Jeffrey Epstein Flight Logs - 118 Page PDF DL: tinyearn dot com/epstein #Epstein #EpsteinCoverUp #EpsteinFiles #EpsteinList #epsteinflightlogs
Ze Russian 🇷🇺

Ze Russian 🇷🇺

32 likes

Food logs
Day 1 no lunch this is dinner some random brand frozen pizza, a rice pudding. about 1 cup of Kefir (I know this may be odd, I like it, I only drink mango) would probably will eat something else but, this is my effort today. Good night all #my plate 🤪 #meals 🍽️ #showingupformyself #a
kryill

kryill

8 likes

building a reindeer out of logs
#winterdeer #holidaydecor #woodworking #logreindeer
Coffee and Sawdust

Coffee and Sawdust

5 likes

The Dinosaur shaped Shelter
#camping #s urvival #travel #2025 #b ushcraft
Camping.Logs

Camping.Logs

9 likes

See more