Pallat Anchaleechamaikorn
Technical Coach
Infinitas by KrungThai
Arise by Infinitas
| FATAL | ERROR | WARN | INFO | DEBUG | TRACE | |
|---|---|---|---|---|---|---|
| OFF | ||||||
| FATAL | x | |||||
| ERROR | x | x | ||||
| WARN | x | x | x | |||
| INFO | x | x | x | x | ||
| DEBUG | x | x | x | x | x | |
| TRACE | x | x | x | x | x | x |
https://www.crowdstrike.com/cybersecurity-101/observability/debug-logging/
console.log('==========');
console.log(err);
DEBUG: Fetching mailing list {"listid":14777}
or TRACE: Fetching mailing list {"listid":14777}
or Unit Testing
level=INFO msg=Connecting to the server...
level=INFO msg=No Content.
level=WARN msg=WARNING WARNING WARNING
level=WARN msg=context deadline exceeded
or level=ERROR msg=context deadline exceeded
or add to metric
level=ERROR msg=Get "http://example.com/api": dial tcp: lookup example.co: no such host
How about if it's ok but http status is 404
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>404 - Not Found</title>
</head>
<body>
<h1>404 - Not Found</h1>
<script type="text/javascript" src="//obj.ac.bcon.ecdns.net/ec_tpm_bcon.js"></script>
</body>
</html>
slog.Error("not found")
time=2023-11-14T21:41:20.632+07:00 level=ERROR source=handler.go:25 msg=not found
slog.Error("result failed")
time=2023-11-14T21:41:20.632+07:00 level=ERROR source=handler.go:25 msg=result failed
https://medium.com/@sniederm/10-rules-to-microservice-logging-4d24f6dd7abb
https://betterstack.com/community/guides/logging/sensitive-data/
Logging too much data can be distracting and a poor use of resources. Indeed, transferring, storing and parsing logs is expensive, so minimizing what the log files contains can minimize cost and resources. Still, logging is king, especially when it comes to traditional monolithic architectures
https://www.bmc.com/blogs/monitoring-logging-tracing/
level=INFO msg=PaymentService - Payment processed successfully for Order #12345
ERROR
WARN
INFO
DEBUG
https://cloud.google.com/blog/products/devops-sre/cloud-logging-cost-management-best-practices