{"result":{"depiction_url":null,"edges":{"hasreference":{"objects":[{"created":"2026-10-07T11:13:48Z","object_id":{"id":3079,"is_a":["text","documentation","adminguide"],"name":"admin_logs","title":{"_type":"trans","tr":{"en":"Read logs and collect useful evidence"}},"uri":"https:\/\/zotonic.com\/id\/3079"},"seq":1}],"predicate":{"id":2774,"is_a":["meta","predicate"],"name":"hasreference","title":{"_type":"trans","tr":{"en":"Documentation reference"}},"uri":"https:\/\/zotonic.com\/id\/hasreference"}},"references":{"objects":[{"created":"2020-05-30T05:48:14Z","object_id":{"id":1454,"is_a":["text","documentation","reference"],"name":"doc_developerguide_configuration_zotonic_configuration","title":"Global configuration","uri":"https:\/\/zotonic.com\/id\/1454"},"seq":1000000}],"predicate":{"id":332,"is_a":["meta","predicate"],"name":"references","title":{"_type":"trans","tr":{"en":"References"}},"uri":"https:\/\/zotonic.com\/id\/references"}},"relation":{"objects":[{"created":"2026-10-07T11:13:48Z","object_id":{"id":2935,"is_a":["text","documentation","developerguide"],"name":"developer_logs_processes","title":{"_type":"trans","tr":{"en":"Inspect logs and running processes"}},"uri":"https:\/\/zotonic.com\/id\/2935"},"seq":1},{"created":"2026-10-07T11:13:48Z","object_id":{"id":2963,"is_a":["text","documentation","developerguide"],"name":"developer_background_work","title":{"_type":"trans","tr":{"en":"Run work outside a request"}},"uri":"https:\/\/zotonic.com\/id\/2963"},"seq":2},{"created":"2020-05-30T05:48:14Z","object_id":{"id":1580,"is_a":["text","documentation","cookbook"],"name":"doc_cookbook_logstash","title":{"_type":"trans","tr":{"en":"Send structured logs to Logstash"}},"uri":"https:\/\/zotonic.com\/id\/1580"},"seq":3},{"created":"2020-05-30T05:48:14Z","object_id":{"id":1858,"is_a":["text","documentation","reference","module"],"name":"doc_module_mod_logging","title":"mod_logging","uri":"https:\/\/zotonic.com\/id\/1858"},"seq":4}],"predicate":{"id":303,"is_a":["meta","predicate"],"name":"relation","title":{"_type":"trans","tr":{"nl":"Relatie","en":"Relation"}},"uri":"http:\/\/purl.org\/dc\/terms\/relation"}},"subject":{"objects":[{"created":"2026-10-07T11:13:48Z","object_id":{"id":2554,"is_a":["categorization","keyword","keyword_information_type"],"name":"zotonic_topic_how_to_guide","title":"How-to guide","uri":"https:\/\/zotonic.com\/id\/2554"},"seq":1},{"created":"2026-10-07T11:13:48Z","object_id":{"id":2564,"is_a":["categorization","keyword","keyword_audience"],"name":"zotonic_topic_backend_developer","title":"Backend developer","uri":"https:\/\/zotonic.com\/id\/2564"},"seq":2},{"created":"2026-10-07T11:13:48Z","object_id":{"id":2607,"is_a":["categorization","keyword","keyword_domain"],"name":"zotonic_topic_logging_and_monitoring","title":"Logging and monitoring","uri":"https:\/\/zotonic.com\/id\/2607"},"seq":3},{"created":"2026-10-07T11:13:48Z","object_id":{"id":2670,"is_a":["categorization","keyword","keyword_technology"],"name":"zotonic_topic_erlang_otp","title":"Erlang\/OTP","uri":"https:\/\/zotonic.com\/id\/2670"},"seq":4}],"predicate":{"id":308,"is_a":["meta","predicate"],"name":"subject","title":{"_type":"trans","tr":{"en":"Keyword"}},"uri":"http:\/\/purl.org\/dc\/elements\/1.1\/subject"}}},"id":1640,"is_a":["text","documentation","developerguide"],"links":[{"rel":"self","target":"https:\/\/zotonic.com\/.zotonic\/websub\/topic\/1640"},{"rel":"hub","target":"https:\/\/zotonic.com\/.zotonic\/websub"}],"medium":null,"medium_url":null,"name":"doc_developerguide_logging","page_url":{"en":"https:\/\/zotonic.com\/docs\/1640\/write-logs-that-explain-an-operation","x-default":"https:\/\/zotonic.com\/docs\/1640\/write-logs-that-explain-an-operation"},"preview_url":null,"resource":{"body":{"_type":"trans","tr":{"en":"<pre class=\"notranslate\"><code class=\"notranslate language-erlang\">?LOG_ERROR(#{\n    text =&gt; &lt;&lt;&quot;Garden update failed&quot;&gt;&gt;,\n    in =&gt; mod_garden,\n    result =&gt; error,\n    reason =&gt; Reason\n}).\n<\/code><\/pre>\n<p>Use the logging macros from <code>zotonic_core\/include\/zotonic.hrl<\/code> when that header is already included. Branch on the actual result of the operation before logging success or failure.<\/p>\n<h2>Read logs and collect useful evidence<\/h2>\n<p><strong>Access needed:<\/strong> Site log permission or server log access.<\/p>\n<aside><p>Container and host service logs may be stored in different places.<\/p><\/aside>\n<ol><li>Record the time, environment, hostname, affected page, and action that failed.<\/li><li>Check the relevant site log or service log around that time.<\/li><li>Identify the first relevant error and its module, request or correlation identifier, and repeated causes.<\/li><li>Compare with the last deployment or configuration change.<\/li><li>Reproduce once with safe test data when possible and note the expected and actual result.<\/li><li>Share a short redacted excerpt and the reproduction steps with the responsible operator or developer.<\/li><\/ol>\n<p>Do not publish complete configuration dumps, cookies, authorization headers, password-reset URLs, or message bodies. Retain detailed logs in the controlled incident record.<\/p>\n<p>More logging is not always better: temporary debug logging can expose data or fill disks. If enabled for diagnosis, record the change and turn it off afterwards.<\/p>"}},"category_id":{"id":317,"is_a":["meta","category"],"name":"developerguide","title":"Developer guide","uri":"https:\/\/zotonic.com\/id\/developerguide"},"content_group_id":{"id":339,"is_a":["meta","content_group"],"name":"default_content_group","title":{"_type":"trans","tr":{"en":"Default Content Group"}},"uri":"https:\/\/zotonic.com\/id\/default_content_group"},"created":"2020-05-30T05:47:29Z","creator_id":{"id":336,"is_a":["person","robot"],"name":"gitbot","title":"Git","uri":"https:\/\/zotonic.com\/id\/336"},"doc_editorial_bundle":true,"doc_editorial_edges":{"hasreference":[3079],"relation":[2935,2963],"subject":[2554,2564,2607,2670]},"github_url":"https:\/\/github.com\/zotonic\/zotonic\/tree\/master\/doc\/developer-guide\/logging.rst","is_authoritative":true,"is_dependent":false,"is_featured":false,"is_protected":false,"is_published":true,"is_unfindable":false,"language":["en"],"modified":"2026-10-07T20:45:38Z","modifier_id":{"id":1,"is_a":["person"],"name":"administrator","title":"Site Administrator","uri":"https:\/\/zotonic.com\/id\/1"},"name":"doc_developerguide_logging","pivot_geocode":null,"pivot_location_lat":null,"pivot_location_lng":null,"privacy":0,"publication_end":"9999-06-01T00:00:00Z","publication_start":"2022-02-15T10:01:21Z","slug":"write-logs-that-explain-an-operation","summary":{"_type":"trans","tr":{"en":"Log the operation and its result with structured fields. Include an identifier that helps connect the message to a resource or job, without logging credentials or complete private request data."}},"title":{"_type":"trans","tr":{"en":"Write logs that explain an operation"}},"title_slug":{"_type":"trans","tr":{"en":"write-logs-that-explain-an-operation"}},"tz":"UTC","uri":null,"version":39,"visible_for":0},"uri":"https:\/\/zotonic.com\/id\/1640","uri_template":"https:\/\/zotonic.com\/id\/:id","websub":{"hub":"https:\/\/zotonic.com\/.zotonic\/websub","topic":"https:\/\/zotonic.com\/.zotonic\/websub\/topic\/1640"}},"status":"ok"}