Fundamentals of Logging

Logging is the process of creating a trail of logs of a particular process or logic flow.

What is a log?

A log is a record of an event.

What types of events should be logged?

Events that should be logged depends on the use-case….


This content originally appeared on DEV Community and was authored by Sankararaman K

Logging is the process of creating a trail of logs of a particular process or logic flow.

What is a log?

A log is a record of an event.

What types of events should be logged?

Events that should be logged depends on the use-case. Some use-cases where events should be logged are

  1. Failure logging
    • Log a trail of events that can lead to failure
    • Make sure these events don't create noice during successful execution
    • For example:
[Thu Mar 13 19:04:13 2014] [error] [client 10.1.10.50] File does not exist: /var/www/favicon.ico
  1. Analytics logging
    • Log API endpoints to identify which APIs are frequently used
    • Log execution duration to track API response times
    • For example:
10.1.10.50 [Thu Mar 13 19:04:13 2014] 808840 “GET /inventory/item?itemId=234” 500”

Other Considerations

  1. Logs should readable
  2. Logs should not be noisy
  3. Logs should be searchable and filterable
    • This can be done by assign a unique ID to every request and it can be used to filter all logs related to that ID

What other types of events do you log? What other parameters do you consider while defining a log? Feel free to add them in the comments!


This content originally appeared on DEV Community and was authored by Sankararaman K


Print Share Comment Cite Upload Translate Updates
APA

Sankararaman K | Sciencx (2024-11-08T06:37:17+00:00) Fundamentals of Logging. Retrieved from https://www.scien.cx/2024/11/08/fundamentals-of-logging/

MLA
" » Fundamentals of Logging." Sankararaman K | Sciencx - Friday November 8, 2024, https://www.scien.cx/2024/11/08/fundamentals-of-logging/
HARVARD
Sankararaman K | Sciencx Friday November 8, 2024 » Fundamentals of Logging., viewed ,<https://www.scien.cx/2024/11/08/fundamentals-of-logging/>
VANCOUVER
Sankararaman K | Sciencx - » Fundamentals of Logging. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/11/08/fundamentals-of-logging/
CHICAGO
" » Fundamentals of Logging." Sankararaman K | Sciencx - Accessed . https://www.scien.cx/2024/11/08/fundamentals-of-logging/
IEEE
" » Fundamentals of Logging." Sankararaman K | Sciencx [Online]. Available: https://www.scien.cx/2024/11/08/fundamentals-of-logging/. [Accessed: ]
rf:citation
» Fundamentals of Logging | Sankararaman K | Sciencx | https://www.scien.cx/2024/11/08/fundamentals-of-logging/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.