{"action":"created","issue":{"url":"https://api.github.com/repos/GeoNet/log/issues/5","repository_url":"https://api.github.com/repos/GeoNet/log","labels_url":"https://api.github.com/repos/GeoNet/log/issues/5/labels{/name}","comments_url":"https://api.github.com/repos/GeoNet/log/issues/5/comments","events_url":"https://api.github.com/repos/GeoNet/log/issues/5/events","html_url":"https://github.com/GeoNet/log/issues/5","id":147276259,"number":5,"title":"Fails to log at end of exiting application","user":{"login":"quiffman","id":1026117,"avatar_url":"https://avatars.githubusercontent.com/u/1026117?v=3","gravatar_id":"","url":"https://api.github.com/users/quiffman","html_url":"https://github.com/quiffman","followers_url":"https://api.github.com/users/quiffman/followers","following_url":"https://api.github.com/users/quiffman/following{/other_user}","gists_url":"https://api.github.com/users/quiffman/gists{/gist_id}","starred_url":"https://api.github.com/users/quiffman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/quiffman/subscriptions","organizations_url":"https://api.github.com/users/quiffman/orgs","repos_url":"https://api.github.com/users/quiffman/repos","events_url":"https://api.github.com/users/quiffman/events{/privacy}","received_events_url":"https://api.github.com/users/quiffman/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/GeoNet/log/labels/help%20wanted","name":"help wanted","color":"159818"}],"state":"open","locked":false,"assignee":{"login":"gclitheroe","id":1016463,"avatar_url":"https://avatars.githubusercontent.com/u/1016463?v=3","gravatar_id":"","url":"https://api.github.com/users/gclitheroe","html_url":"https://github.com/gclitheroe","followers_url":"https://api.github.com/users/gclitheroe/followers","following_url":"https://api.github.com/users/gclitheroe/following{/other_user}","gists_url":"https://api.github.com/users/gclitheroe/gists{/gist_id}","starred_url":"https://api.github.com/users/gclitheroe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gclitheroe/subscriptions","organizations_url":"https://api.github.com/users/gclitheroe/orgs","repos_url":"https://api.github.com/users/gclitheroe/repos","events_url":"https://api.github.com/users/gclitheroe/events{/privacy}","received_events_url":"https://api.github.com/users/gclitheroe/received_events","type":"User","site_admin":false},"milestone":null,"comments":4,"created_at":"2016-04-10T22:58:46Z","updated_at":"2016-04-12T21:44:59Z","closed_at":null,"body":"I'm not sure this is a bug per se, but it was slightly unexpected behaviour - any help here would be appreciated.\r\n\r\nI have a short lived go application, that exits immediately after success. To monitor that success I decided to add a log line just before the end of the main function, but never saw the calls to log make it to logentries.\r\n\r\nIt seems to me like the application is exiting before the logentries write go process gets to do its thing.\r\nBy way of example, I can't get the following application to consistently send to logentries:\r\n```\r\npackage main\r\n\r\nimport (\r\n\t_ \"github.com/GeoNet/log/logentries\"\r\n\t\"log\"\r\n)\r\n\r\nfunc main() {\r\n\tlog.SetPrefix(\"log1 \")\r\n\tlog.Print(\"Hello Logentries.\")\r\n}\r\n```\r\n\r\nBut chuck a sleep delay in there and it works fine:\r\n```\r\npackage main\r\n\r\nimport (\r\n\t_ \"github.com/GeoNet/log/logentries\"\r\n\t\"log\"\r\n\t\"time\"\r\n)\r\n\r\nfunc main() {\r\n\tlog.SetPrefix(\"log2 \")\r\n\tlog.Print(\"Hello Logentries.\")\r\n\ttime.Sleep(time.Duration(5) * time.Second)\r\n}\r\n```\r\n\r\n\r\nGiven the design \"Uses a buffered chan to avoid blocking the application.\", it's entirely possible this is expected behaviour. I just wasn't expecting it ;-)\r\n\r\n\r\nIs there any sensible way I can force the log to flush, prior to exiting the application?\r\n\r\nAssigning to Geoff, but help or suggestions from any other @GeoNet/sysdev-team members would also be appreciated."},"comment":{"url":"https://api.github.com/repos/GeoNet/log/issues/comments/209115949","html_url":"https://github.com/GeoNet/log/issues/5#issuecomment-209115949","issue_url":"https://api.github.com/repos/GeoNet/log/issues/5","id":209115949,"user":{"login":"quiffman","id":1026117,"avatar_url":"https://avatars.githubusercontent.com/u/1026117?v=3","gravatar_id":"","url":"https://api.github.com/users/quiffman","html_url":"https://github.com/quiffman","followers_url":"https://api.github.com/users/quiffman/followers","following_url":"https://api.github.com/users/quiffman/following{/other_user}","gists_url":"https://api.github.com/users/quiffman/gists{/gist_id}","starred_url":"https://api.github.com/users/quiffman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/quiffman/subscriptions","organizations_url":"https://api.github.com/users/quiffman/orgs","repos_url":"https://api.github.com/users/quiffman/repos","events_url":"https://api.github.com/users/quiffman/events{/privacy}","received_events_url":"https://api.github.com/users/quiffman/received_events","type":"User","site_admin":false},"created_at":"2016-04-12T21:44:59Z","updated_at":"2016-04-12T21:44:59Z","body":"I really don't know.\r\n\r\nI suspect this requires a bit more thought than I can give it at the moment."}}