{"action":"created","issue":{"url":"https://api.github.com/repos/TEAMMATES/teammates/issues/4793","repository_url":"https://api.github.com/repos/TEAMMATES/teammates","labels_url":"https://api.github.com/repos/TEAMMATES/teammates/issues/4793/labels{/name}","comments_url":"https://api.github.com/repos/TEAMMATES/teammates/issues/4793/comments","events_url":"https://api.github.com/repos/TEAMMATES/teammates/issues/4793/events","html_url":"https://github.com/TEAMMATES/teammates/pull/4793","id":134483123,"number":4793,"title":"Severe logs without error data #4550","user":{"login":"wkurniawan07","id":7261051,"avatar_url":"https://avatars.githubusercontent.com/u/7261051?v=3","gravatar_id":"","url":"https://api.github.com/users/wkurniawan07","html_url":"https://github.com/wkurniawan07","followers_url":"https://api.github.com/users/wkurniawan07/followers","following_url":"https://api.github.com/users/wkurniawan07/following{/other_user}","gists_url":"https://api.github.com/users/wkurniawan07/gists{/gist_id}","starred_url":"https://api.github.com/users/wkurniawan07/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wkurniawan07/subscriptions","organizations_url":"https://api.github.com/users/wkurniawan07/orgs","repos_url":"https://api.github.com/users/wkurniawan07/repos","events_url":"https://api.github.com/users/wkurniawan07/events{/privacy}","received_events_url":"https://api.github.com/users/wkurniawan07/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/TEAMMATES/teammates/labels/s.ToReview","name":"s.ToReview","color":"47B74E"}],"state":"open","locked":false,"assignee":{"login":"thyageshm","id":5160137,"avatar_url":"https://avatars.githubusercontent.com/u/5160137?v=3","gravatar_id":"","url":"https://api.github.com/users/thyageshm","html_url":"https://github.com/thyageshm","followers_url":"https://api.github.com/users/thyageshm/followers","following_url":"https://api.github.com/users/thyageshm/following{/other_user}","gists_url":"https://api.github.com/users/thyageshm/gists{/gist_id}","starred_url":"https://api.github.com/users/thyageshm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thyageshm/subscriptions","organizations_url":"https://api.github.com/users/thyageshm/orgs","repos_url":"https://api.github.com/users/thyageshm/repos","events_url":"https://api.github.com/users/thyageshm/events{/privacy}","received_events_url":"https://api.github.com/users/thyageshm/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/TEAMMATES/teammates/milestones/195","html_url":"https://github.com/TEAMMATES/teammates/milestones/V5.69","labels_url":"https://api.github.com/repos/TEAMMATES/teammates/milestones/195/labels","id":1587725,"number":195,"title":"V5.69","description":"","creator":{"login":"thyageshm","id":5160137,"avatar_url":"https://avatars.githubusercontent.com/u/5160137?v=3","gravatar_id":"","url":"https://api.github.com/users/thyageshm","html_url":"https://github.com/thyageshm","followers_url":"https://api.github.com/users/thyageshm/followers","following_url":"https://api.github.com/users/thyageshm/following{/other_user}","gists_url":"https://api.github.com/users/thyageshm/gists{/gist_id}","starred_url":"https://api.github.com/users/thyageshm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thyageshm/subscriptions","organizations_url":"https://api.github.com/users/thyageshm/orgs","repos_url":"https://api.github.com/users/thyageshm/repos","events_url":"https://api.github.com/users/thyageshm/events{/privacy}","received_events_url":"https://api.github.com/users/thyageshm/received_events","type":"User","site_admin":false},"open_issues":23,"closed_issues":14,"state":"open","created_at":"2016-02-17T07:15:22Z","updated_at":"2016-02-22T13:10:42Z","due_on":"2016-02-22T16:00:00Z","closed_at":null},"comments":10,"created_at":"2016-02-18T05:07:03Z","updated_at":"2016-02-23T04:14:09Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/TEAMMATES/teammates/pulls/4793","html_url":"https://github.com/TEAMMATES/teammates/pull/4793","diff_url":"https://github.com/TEAMMATES/teammates/pull/4793.diff","patch_url":"https://github.com/TEAMMATES/teammates/pull/4793.patch"},"body":"Fixes #4550\r\nHere's what happened: take a look at these lines in `ControllerServlet`:\r\n```java\r\nMimeMessage email = new Logic().emailErrorReport(req, e); // can be null\r\nlog.severe(ActivityLogEntry.generateSystemErrorReportLogMessage(req, email));\r\n```\r\nHere, if the variable `email` is null, the log will have no data, which is what is seen in the issue thread.\r\nHow can the variable `email` be null? Further probing will bring us to this function in `Emails.java`:\r\n```java\r\npublic MimeMessage sendErrorReport(HttpServletRequest req, Throwable error) {\r\n    MimeMessage email = null;\r\n    try {\r\n        ...\r\n        email = generateSystemErrorEmail(...) // this function can throw Exception\r\n        ...\r\n    } catch (Exception e) {\r\n        logSevereForErrorInSendingItem(\"crash report\", email, e);\r\n    }\r\n    return email;\r\n}\r\n```\r\nThat is, the `email` will be null if there is an error in generating the system error email.\r\n\r\nTo alleviate, when such failure occurs, an alternative severe log will be done from `Emails.java` which will show the error's stack trace, on top of also sending the reason for why the crash report failed to send (i.e if the crash report failed to send the admin will receive _two_ severe logs: one logging the error that's supposedly reported in the crash report, and another one logging why the crash report failed to send).\r\n\r\n(P.S the newly added stack traces will also have no line breaks)"},"comment":{"url":"https://api.github.com/repos/TEAMMATES/teammates/issues/comments/187517573","html_url":"https://github.com/TEAMMATES/teammates/pull/4793#issuecomment-187517573","issue_url":"https://api.github.com/repos/TEAMMATES/teammates/issues/4793","id":187517573,"user":{"login":"thyageshm","id":5160137,"avatar_url":"https://avatars.githubusercontent.com/u/5160137?v=3","gravatar_id":"","url":"https://api.github.com/users/thyageshm","html_url":"https://github.com/thyageshm","followers_url":"https://api.github.com/users/thyageshm/followers","following_url":"https://api.github.com/users/thyageshm/following{/other_user}","gists_url":"https://api.github.com/users/thyageshm/gists{/gist_id}","starred_url":"https://api.github.com/users/thyageshm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thyageshm/subscriptions","organizations_url":"https://api.github.com/users/thyageshm/orgs","repos_url":"https://api.github.com/users/thyageshm/repos","events_url":"https://api.github.com/users/thyageshm/events{/privacy}","received_events_url":"https://api.github.com/users/thyageshm/received_events","type":"User","site_admin":false},"created_at":"2016-02-23T04:14:09Z","updated_at":"2016-02-23T04:14:09Z","body":"This one is good to go.  Just open a new issue. \r\n@damithc read for your review "}}