Logging: Recording useful messages about what an application is doing, such as events, warnings, and errors, so that people can understand and investigate problems later.

Example

When an order fails, your code logs "Payment failed for order 10234: gateway timeout after 30s". Next morning, support searches the logs for order 10234 and finds the cause in a minute.

Log Levels

LevelUse it for
ERRORSomething failed and needs attention
WARNSomething unexpected, but the app continued
INFOImportant normal events, such as an order placed
DEBUGDetailed information for developers, usually off in production

What to Log and What Never to Log

  • Do log: what happened, an ID to trace it (order ID, user ID, request ID), and the error message.
  • Don't log: passwords, OTPs, tokens, card numbers, or unnecessary personal data.
  • Don't flood logs with a message for every loop iteration; important messages get lost.

Logging in Real Teams

In production, you can't pause the program with a debugger, so logs are often the only way to see what happened. Teams send logs to central tools such as the ELK stack, Splunk, Azure Monitor, or CloudWatch, and set alerts on errors as part of monitoring. Use the team's logging library rather than print statements.

Related terms

  • Monitoring: uses logs and metrics to watch system health.
  • Debugging: logs help you debug where breakpoints can't.
  • Error Handling: good error handling logs useful details.
  • Exception: exceptions should be logged with context.

Previous term: Library  |  Next term: Machine Learning (ML)

Related guides

Frequently asked questions

What is logging in software?

Logging is recording messages about what an application is doing, such as events and errors, so problems can be investigated later.

What are log levels?

Categories such as ERROR, WARN, INFO, and DEBUG that show how serious a message is and let teams filter logs.

What should never be logged?

Passwords, OTPs, tokens, card numbers, and unnecessary personal data.

Why not just use print statements?

Logging libraries add timestamps and levels, can send logs to central tools, and can be switched on or off without code changes.

Explore more internship terms

The IT Internship Glossary explains 199 terms you will hear before and during your internship, with simple definitions and real examples.

Browse all 199 terms
Dhaivat Ajwaliya

About the author

Dhaivat Ajwaliya

Dhaivat has 16+ years of experience in the IT industry, working on AI and cloud technologies, project delivery, and engineering leadership. He has interviewed and mentored many interns, wrote The Lost Intern, and runs the non-commercial Career Impact Initiative, mentoring students for free.