Closed neophob closed 6 years ago
Any news on this? Am using this nice wrapper in a Ionic/cordova app, my only problem is when the app is offline and a error occurs it will try to log to loggly and this fires another error which sends the app into a infinite loop and it eventually crashes. Is there anyway to disable and enable the logglyLogger at runtime? that way I would be able to disable it when "offline" event fires and enable when "online" event fires.
@icedice Thanks for the info, I didn't realize how bad this really was. I was holding off on this feature for the next major release, but from the sound of it it's much more urgent. I'll throw something together here in the next couple of days.
You don't need to hurry. I did a quick customisation of your (great) wrapper så it only tries to contact loggly if it is online. This means that I loose messages when the app is offline but this is not critical for me also it could be solved with some kind of cache which then sends it when it's back online. Anyways I still thing this would be a great feature en a future release.
Would you mind opening a pull request for it? I'd love to see what you've done.
On Fri, Sep 9, 2016 at 11:22 AM, Toke Refstrup notifications@github.com wrote:
You don't need to hurry. I did a quick customisation of your (great) wrapper så it only tries to contact loggly if it is online. This means that I loose messages when the app is offline but this is not critical for me also it could be solved with some kind of cache which then sends it when it's back online. Anyways I still thing this would be a great feature en a future release.
— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/ajbrown/angular-loggly-logger/issues/36#issuecomment-245945392, or mute the thread https://github.com/notifications/unsubscribe-auth/AACWMvUHERfFsKVdmpY3LiqqIbYKJ4xdks5qoXmbgaJpZM4GvR72 .
A.J. Brown @adrianjbrown http://twitter.com/adrianjbrown on Twitter http://ajbrown.org on The Web
Sure, but it's just a really quick fix, basically I just surrounded the ajax call to loggly so it only gets called if we have net. I'm using Cordova network plugin if available otherwise I use navigator.onLine....
If you don't catch http request fails they will be handled by loggly. In my case to prevent endless offline logs i have to add .catch(console.error) to $http.post that logger method uses to send logs.
//current version
//Ajax call to send data to logglyÎ
$http.post(buildUrl(), sentData, config);
//my fix
//Ajax call to send data to logglyÎ
$http.post(buildUrl(), sentData, config).catch(console.error);
`
I assume this project has likely kicked the bucket, but I wanted to point out how serious of an issue this is. I've confirmed that users who use uBlock Origin are likely heavily affected by this issue, because loggly is blocked before the request goes out. This mimics an "offline" effect, throwing the app into an infinite memory-consuming loop.
See uBlock's logs below:
See Firefox's Memory Usage as well:
(Same issue in Chrome though at least Chrome will abort the tab after a certain point)
If I didn't know any better I would have thought something malicious was going on 😬
@Cleod9 thanks for kicking this back to my inbox. I just merged the PR for this in and will cut a new release here shortly.
This has been fixed and released in 0.3.2
I would like the (rare) case that when the user is offline, I don't want that the my application fails (blocks). One simple solution would be to add a timeout to the request:
src: https://gist.github.com/hale/5901734
what do you think?
Cheers