-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question about the root.detachAndStopAllAppenders()
call
#64
Comments
Hello, Thank you for the detailed issue
I don't have the history, but I think the purpose is re-reading configuration information while keeping only one appender at once. It is needed for dynamic configuration change.
If you call If you want to work on a real solution, any PR is welcome, we are open to contributions 👍 |
In #1137 we implemented a new File logger mechanism Unfortunately this has a side effect on react-native-background-geolocation which has a logger mechanism based on the same library and fails to work if we enable our new File logger A solution is investigated in BeTomorrow/react-native-file-logger#64 but until then we want to disable the feature so we can continue publishing the app Related PR: #1137 Related Issue: BeTomorrow/react-native-file-logger#64
In #1137 we implemented a new File logger mechanism Unfortunately this has a side effect on react-native-background-geolocation which has a logger mechanism based on the same library and fails to work if we enable our new File logger A solution is investigated in BeTomorrow/react-native-file-logger#64 but until then we want to disable the feature so we can continue publishing the app Related PR: #1137 Related Issue: BeTomorrow/react-native-file-logger#64
For sure, I would be happy to contribute
Do you mean if the developper want to call For now I see two potential solutions. First one would be to add a parameter Second one would be to find a way to detach only the react-native-file-logger appenders (if they exist). I prefer this one but I don't know yet if this is possible. There is a detachAppender(String name) method that may help. But there is no mention of the |
I tried this idea in the Pull Request #66 . I have publish the fixed version @Ldoppea Can you install this version and tell me if it works better with react-native-background-geolocation ?
|
Hi, Thanks for the time you spent on this 👍 My project is using an old ReactNative version so I'm stuck with But I did the test by applying the same modification and it works very well 😃 |
In #1183 we disabled the new File logger mechanism due to a side effect with react-native-background-geolocation This was because react-native-file-logger would reset all log appenders during initialisation which would prevent native-background-geolocation to work This commit applies the fix from BeTomorrow/react-native-file-logger#66 (we cannot update the lib as we are still using ReactNative old architecture) Related PR: #1183 Related issue: BeTomorrow/react-native-file-logger#64 Related issue: BeTomorrow/react-native-file-logger#66
I see, thanks for reporting this. |
In #1183 we disabled the new File logger mechanism due to a side effect with react-native-background-geolocation This was because react-native-file-logger would reset all log appenders during initialisation which would prevent native-background-geolocation to work This commit applies the fix from BeTomorrow/react-native-file-logger#66 (we cannot update the lib as we are still using ReactNative old architecture) Related PR: #1183 Related issue: BeTomorrow/react-native-file-logger#64 Related issue: BeTomorrow/react-native-file-logger#66
In #1183 we disabled the new File logger mechanism due to a side effect with react-native-background-geolocation This was because react-native-file-logger would reset all log appenders during initialisation which would prevent native-background-geolocation to work This commit applies the fix from BeTomorrow/react-native-file-logger#66 (we cannot update the lib as we are still using ReactNative old architecture) Related PR: #1183 Related issue: BeTomorrow/react-native-file-logger#64 Related issue: BeTomorrow/react-native-file-logger#66
hi @fdrault sorry i would like to reopen this issue, I just found that the iOS part has a similar bug as it also call The difference with the android part is that there is no visible exception. In our app, the first logger has enough time to be created, then to logs some lines, and finally it is removed by I wanted to make a PR with a fix, but unfortunately, CocoaLumberjack doesn't seems to allow removing a logger by name like logback-android does. The removeLogger methods seems to only take a reference to an existing logger but I did not find any method that take a string as an ID. The allLogger method may be useful too, but here again I don't see any way to distinguish between the RNFileLogger's loggers and others. Do you have any idea on how to handle this? |
I am re-opening the issue, thanks for your research |
In #1187 we fixed the new File logger initialization on Android as it would break the react-native-background-geolocation plugin's internal File logger This was because react-native-file-logger would reset all log appenders during initialisation which would prevent native-background-geolocation to work This bug was also present in iOS but appeared latter so we did not notice it and so we did not fix it on initial PR This commit applies the fix from BeTomorrow/react-native-file-logger#69 (we cannot update the lib as we are still using ReactNative old architecture) Related PR: #1187 Related PR: #1183 Related issue: BeTomorrow/react-native-file-logger#64 Related issue: BeTomorrow/react-native-file-logger#66 Related issue: BeTomorrow/react-native-file-logger#69
Hi, I just tested @alois-beto 's fix on my project and it works like a charm. I didn't expect the fix to be that simple, congrats 😅 Thank you for your help @alois-beto and @fdrault 👍 |
In #1187 we fixed the new File logger initialization on Android as it would break the react-native-background-geolocation plugin's internal File logger This was because react-native-file-logger would reset all log appenders during initialisation which would prevent native-background-geolocation to work This bug was also present in iOS but appeared latter so we did not notice it and so we did not fix it on initial PR This commit applies the fix from BeTomorrow/react-native-file-logger#69 (we cannot update the lib as we are still using ReactNative old architecture) Related PR: #1187 Related PR: #1183 Related issue: BeTomorrow/react-native-file-logger#64 Related issue: BeTomorrow/react-native-file-logger#66 Related issue: BeTomorrow/react-native-file-logger#69
Hi,
First, thank you for this project, I started using it a few days ago and it makes way easier to get debug data from the app's testers
I'm investigating an incompatibility between react-native-file-logger and react-native-background-geolocation which has its own log mechanism, also based on logback-android
When using both libraries, then the geolocation library stops working
I just found that this is because react-native-file-logger calls root.detachAndStopAllAppenders() during its initialization. Due to this, the react-native-background-geolocation's appenders are cleared and so it cannot do its job anymore
I tried to remove this line locally and it fixes the problem
The question is now: why is this line needed?
The project's history says that it has been added in this specific commit: 5c04853
Because it was not initially there and because it has been added later, my conclusion is that it is here for a specific purpose (i.e. to fix a bug) and so I don't want to remove it without understanding why it was here in the first place
So my two question are:
Thanks
The text was updated successfully, but these errors were encountered: