betomorrow / react-native-file-logger Goto Github PK
View Code? Open in Web Editor NEWA simple file-logger for React Native with configurable rolling policy, based on CocoaLumberjack on iOS and Logback on Android.
A simple file-logger for React Native with configurable rolling policy, based on CocoaLumberjack on iOS and Logback on Android.
Hi,
I have an expo-managed project that is using expo SDK 47 where native modules can be added to a project via development build.
I am getting the following error when I run it using the eas build command listed in the expo docs
eas build --profile development --platform ios
Error:
/node
[!] Invalid `Podfile` file:
[!] Invalid `RNFileLogger.podspec` file: undefined method `install_modules_dependencies' for Pod:Module
Did you mean? install_flipper_dependencies.
# from /Users/expo/workingdir/build/node_modules/react-native-file-logger/RNFileLogger.podspec:21
# -------------------------------------------
# ## Dependencies needed for new architecture.
> install_modules_dependencies(s)
#
# -------------------------------------------
.
# from /Users/expo/workingdir/build/packages/mobile/ios/Podfile:14
# -------------------------------------------
# use_expo_modules!
> config = use_native_modules!
#
# -------------------------------------------
Is this due to npx pod install
being an additional step for this package to work correctly? Wouldn't react native auto linking take care of the dependent pod installations automatically?
Also does this require turbo modules to be enabled? I have it off in my project and looking at the code I am expecting it to fallback to the old NativeModule based FileLogger.
Any help is appreciated. Thanks in advance. π
Hello,
It seems react-native-file-logger
depends on react@^16.8.1
. Is there a chance this can be updated to react@^17.0.0
(or whichever 17 version number makes sense).
Thanks.
Hi team, is there any way to make the timespan in the logs file to aline with the local time?
React Native 0.73 will depend on Android Gradle Plugin (AGP) 8.x. This will require all the libraries to specify a namespace in their build.gradle file. We added a compatibility layer for libraries that haven't specified a namespace, but please consider updating your libraries nonetheless.
To follow last recommandation, we need to specify a namespace for our library. It will breaks compatibility with RN<71, so I might wait a bit before comply to this.
I can see that the logs are perfectly fine when printed in the debug console. But for some reason when I check the log file in release mode, it contains such below garbage text throughout the file:
%PARSER_ERROR[msg]%PARSER_ERROR[n]%PARSER_ERROR[msg]%PARSER_ERROR[n]%PARSER_ERROR[msg]%PARSER_ERROR[n]%PARSER_ERROR[msg]%PARSER_ERROR[n]%PARSER_ERROR[msg]%PARSER_ERROR[n]%PARSER_ERROR[msg]%PARSER_ERROR[n]%PARSER_ERROR[msg]%PARSER_ERROR[n]%PARSER_ERROR[msg]%PARSER_ERROR[n]%PARSER_ERROR[msg]%PARSER_ERROR[n]%PARSER_ERROR[msg]%PARSER_ERROR[n]%PARSER_ERROR[msg]%PARSER_ERROR[n]%PARSER_ERROR[msg]%PARSER_ERROR[n]%PARSER_ERROR[msg]%PARSER_ERROR[n]%PARSER_ERROR[msg]%PARSER_ERROR[n]%PARSER_ERROR[msg]%PARSER_ERROR[n]%PARSER_ERROR[msg]%PARSER_ERROR[n]%PARSER_ERROR[msg]%PARSER_ERROR[n]%PARSER_ERROR[msg]%PARSER_ERROR[n]%PARSER_ERROR[msg]%PARSER_ERROR[n]%PARSER_ERROR
......
I started facing this issue abruptly, all my dependencies are unchanged. I am using an older version of react-native-file-logger: v0.3.0
. I checked v0.4.0
version of this module as well, same issue there. v0.5.4
has some problems with pod install
on RN version 0.68.7
that my project is using.
I observed this issue on both platforms: Android and iOS. But seems more prominent on Android.
How could i remove a single log file?
Thanks for the library. I'm however not able to get it to work on Android 10. It basically hangs on FileLogger.sendLogFilesByEmail(...)
Is it possible to add logs to the same file from native Android?
Currently unable to use this package because of it's peerdependency until react 18.0.0
Unable to call the function FileLogger.configure({ logLevel: LogLevel.Debug }).then(() => console.log('File-logger configured'), );
Throws warning as follows 'Possible Unhandled Promise Rejection (id: 1): TypeError: Cannot read property 'configure' of null'
I'm Using NX react native project
Hi,
I've started the migration to support the new architecture.
This issue is for tracking the migration
Build failed when install this repo on latest React Native version (0.67.3), it return two error messages
Plugin with id 'maven' not found.
Could not find method mavenDeployer() for arguments [build_4ea9nrup07e5ggy3lwew2e09s$_run_closure4$_closure15$_closure17@30919c66] on repository container of type org.gradle.api.internal.artifacts.dsl.DefaultRepositoryHandler.
For temporary fix, i am just make some changes in build.gradle
About Error 1, update
apply plugin: 'maven'
to
apply plugin: 'maven-publish'
About Error 2, comment installArchives function in build.gradle
Is it possible to write to two different log files. Say for example File A and File B. In File A I need to write only particular logs and in File B all my console and other logs.
Any help is appreciated.
Thanks in advance.
getting this issue while upgrade from 63 to 73.4. Does anybody is getting this error.Please suggest the solution.Thank you.
FATAL EXCEPTION: mqt_native_modules
Process: com.tonik.mobile, PID: 9633
java.lang.IllegalStateException: FileNamePattern [/storage/emulated/0/Android/data/com.tonik.mobile/cache/logs/com.tonik.mobile-%i.log] does not contain a valid DateToken
at com.morfeus.android.mfsdk.s25.start(SourceFile:1)
at com.morfeus.android.mfsdk.up4.start(SourceFile:1)
at com.morfeus.android.mfsdk.t25.start(SourceFile:1)
at com.morfeus.android.mfsdk.vp4.start(SourceFile:1)
at com.betomorrow.rnfilelogger.FileLoggerModule.configure(SourceFile:170)
at java.lang.reflect.Method.invoke(Native Method)
at com.facebook.react.bridge.JavaMethodWrapper.invoke(SourceFile:143)
at com.facebook.react.bridge.JavaModuleWrapper.invoke(SourceFile:22)
at com.facebook.jni.NativeRunnable.run(Native Method)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(SourceFile:1)
at android.os.Looper.loopOnce(Looper.java:240)
at android.os.Looper.loop(Looper.java:351)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(SourceFile:38)
at java.lang.Thread.run(Thread.java:1012)
2024-05-15 17:45:25.600 3796-8276 GmsConnectionFactory com.google.android.gms.persistent E UID for network attribution might be misset for tag 805307399 [CONTEXT service_id=39 ]
elkx: FULL
Can you support other mail composer to send emails other than native one on iphone? I think it is fine for users to leave app when sending log file since they can come back after that. It really confuses users when they click on 'send logs' button but nothing happens, or at least it should throw an error that the Mail app is not configured or something like that.
Hello,
I was wondering if it was possible to add an option to change the file name when sending by e-mail. Maybe it's already possible, but I don't seem to have seen it in the documentation?
Thanks in advance! :)
And thank's for the lib, very easy to use π
Right now by default file is created with .log extension.
I want to change it to .txt so that any one can download it and open in mobile
In our application we are looking for the log file to be uploaded to our logger service on demand, So, I need to get the log file and send it to the logger service via API call. Let me know if there is any method that I should look into.
is there any way to get the log file and upload it in the mail?
If its possible, please add it in info so that it will be helpful.
Any reason why a release build has no log file? Debug build everything works as it should
how can i change format of date and time using this library
i can see that "formatter" prop but any sample example on how to use it
Instead of rolling the log files 24hrs after they are created, I was wondering if we could have the option to cause rollover to happen at midnight. This would make it slightly easier to see when an event occurred in the log, i.e. if a client says "It happened on May 28", then I know I only have to look in one log file, instead of potentially 2 files.
I'm not sure if this is an option available to the underlying Android/iOS libraries, so not sure how much effort it would be.
The Python logging
package has this feature: https://docs.python.org/3/library/logging.handlers.html#timedrotatingfilehandler
Cheers
Adding such feature to the API should be a piece of cake, and it could be crucial for some people because:
Apple has started requiring all 3rd party SDKs to declare the usage of APIs listed here in a privacy manifest. As part of this CocoaLumberjack recently added theirs in this commit
This will impact the upstream apps that rely on this lib and risk getting rejected. The deadline for this change is May 1st but we (app developers) need time to make changes on our end after upgrading this lib. Please Help!
Hi,
I notice that in my log file, there are many long warning messasge which really disturbed me. Is it possible to disable a specific log level, like only disable loglevel.warning?
Thanks
it just creates log file in the cacahe folder, and it does not write anytihing inside it.
import { FileLogger } from "react-native-file-logger";
FileLogger.configure();
I'm using Expo on react-native version 0.72.3 and it fails creating a standalone build for the device (iOS)... Has anyone encountered this?
This is the output from where it fails after running:
npx expo run:ios --device
β Undefined symbols for architecture arm64
ββ Symbol: OBJC_CLASS$_MFMailComposeViewController
ββ Referenced from: objc-class-ref in RNFileLogger(FileLogger.o)
β ld: symbol(s) not found for architecture arm64
β clang: error: linker command failed with exit code 1 (use -v to see invocation)
Run script build phase 'Create Symlinks to Header Folders' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'React-debug' from project 'Pods')
Run script build phase 'Create Symlinks to Header Folders' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'fmt' from project 'Pods')
Run script build phase 'Create Symlinks to Header Folders' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'RCT-Folly' from project 'Pods')
Run script build phase 'Create Symlinks to Header Folders' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'React-utils' from project 'Pods')
Run script build phase 'Create Symlinks to Header Folders' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'React-runtimescheduler' from project 'Pods')
Run script build phase 'Create Symlinks to Header Folders' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'ReactCommon' from project 'Pods')
no rule to process file '/Users/willryan/Development/RapidTapping/rapid-tapping-expo-app/node_modules/react-native-agora-chat/native_src/objc/README.md' of type 'net.daringfireball.markdown' for architecture 'arm64' (in target 'react-native-chat-sdk' from project 'Pods')
Run script build phase 'Create Symlinks to Header Folders' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'React-Codegen' from project 'Pods')
Run script build phase '[CP-User] Generate app.config for prebuilt Constants.manifest' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'EXConstants' from project 'Pods')
Run script build phase '[CP-User] Generate app.manifest for expo-updates' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'EXUpdates' from project 'Pods')
Run script build phase 'Start Packager' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'RapidTapping' from project 'RapidTapping')
Run script build phase 'Bundle React Native code and images' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'RapidTapping' from project 'RapidTapping')
Run script build phase '[CP-User] [RNFB] Core Configuration' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'RapidTapping' from project 'RapidTapping')
βΊ 3 error(s), and 14 warning(s)
CommandError: Failed to build iOS project. "xcodebuild" exited with error code 65.
Hello,
Thank you for this great library! I'm having some issues with my personal iPhone 6s. When calling the method sendLogFilesByEmail
the Promise never gets resolved. On other devices (Android & iOS) it works perfectly.
I think it's related with the default mailing app (I'm using Gmail). If so, it should throw an error that the Mail app is not configured or something like that.
Thanks for the lib!
Have you guys seen any performance issues when logging to files? Is it fast enough not impact the performance of the app?
Hi,
I love this file logger, it's so easy to use. Helped me a lot.
One great enhancement would be to email compressed log files , either a single file containing all log files or several compressed file. This would enable users to share larger log files which might be too big for email. From what I know - log/text files get compressed to about 10% of their original size.
Regards,
Hi,
I am running in to this issue while running the expo/react native generated Android app I have.
> Duplicate class org.slf4j.impl.StaticLoggerBinder found in modules jetified-logback-android-2.0.0-runtime (com.github.tony19:logback-android:2.0.0) and jetified-slf4j-android-1.7.36 (org.slf4j:slf4j-android:1.7.36)
Duplicate class org.slf4j.impl.StaticMDCBinder found in modules jetified-logback-android-2.0.0-runtime (com.github.tony19:logback-android:2.0.0) and jetified-slf4j-android-1.7.36 (org.slf4j:slf4j-android:1.7.36)
Duplicate class org.slf4j.impl.StaticMarkerBinder found in modules jetified-logback-android-2.0.0-runtime (com.github.tony19:logback-android:2.0.0) and jetified-slf4j-android-1.7.36 (org.slf4j:slf4j-android:1.7.36)
The recommended version per the logback README file seems to be 1.7.36 since 2.x is not supported in gradle?
Seems like adding android.enableJetifier=true
to gradle.properties
file could help?
What would be the best way to resolve this? Thanks for your help in advance.
I'm facing the issue when doing pod install. I'm using react-native-file-logger version 0.5.4 I can able to understand the issue where it from. It's because of the line number 22 at package file RNFileLogger.podspec. I didn't use new architecture. My react native version is 0.70. If I commented the line 22 I can able to run the pod install successfully. Any one please help me to bypass that or else provide alternative way to rectify the issue.
If I commented the marked line I can able to run the pod install. I hope it's only for new architecture but I didn't enabled the new architecture.
I am writing logs at around 2:17 pm. My computer and my Android phone are both at the same time.
However, when I write logs, I see the time in the logs as follows:
2022-04-04T18:17:51.856Z [INFO]
Can someone help me to understand which time is this? It may be taking a time from different timezone. Anyone know the fix for this?
Hello, firstly, thanks for this awesome library!
I am having problems with two physical iOS devices - both use GMail instead of native apple mail system and sharing logs ends with
Possible Unhandled Promise Rejection (id: 2):
Error: Cannot send emails on this device
Is it possible to fix this behavior somehow? Even if it was not possible (easily), I would like a hint on what to do in such cases - the promise fails and I would like to tell the user how to share the files in a different way. I would like to avoid direct XHR post, security-wise the email sharing approach is brilliant...
Thanks
React native 0.72.1
iOS 16
Call FileLogger.sendLogFilesByEmail but nothing show up
Got below err from console
Bridge call to: deviceContexts
[Presentation] Attempt to present <MFMailComposeViewController: 0x15cdc4c00> on <RCTModalHostViewController: 0x146910dc0> (from <RCTModalHostViewController: 0x146910dc0>) whose view is not in the window hierarchy.
[AXRuntimeCommon] AX Lookup problem - errorCode:1100 error:Permission denied portName:'com.apple.iphone.axserver' PID:17345 (
0 AXRuntime 0x00000001b8ad9468 _AXGetPortFromCache + 904
1 AXRuntime 0x00000001b8adb5d4 AXUIElementPerformFencedActionWithValue + 768
2 UIKit 0x000000020ee3bd74 630A7729-DCCE-311E-B6BF-226BFFD35685 + 736628
3 libdispatch.dylib 0x00000001053a8028 _dispatch_call_block_and_release + 24
4 libdispatch.dylib 0x00000001053a9860 _dispatch_client_callout + 16
5 libdispatch.dylib 0x00000001053b09bc _dispatch_lane_serial_drain + 688
6 libdispatch.dylib 0x00000001053b1634 _dispatch_lane_invoke + 424
7 libdispatch.dylib 0x00000001053bd158 _dispatch_workloop_worker_thread + 696
8 libsystem_pthread.dylib 0x00000001d97acb50 _pthread_wqthread + 284
9 libsystem_pthread.dylib 0x00000001d97ac67c start_wqthread + 8
)
[AXRuntimeCommon] AX Lookup problem - errorCode:1100 error:Permission denied portName:'com.apple.iphone.axserver' PID:17345 (
0 AXRuntime 0x00000001b8ad9468 _AXGetPortFromCache + 904
1 AXRuntime 0x00000001b8adb5d4 AXUIElementPerformFencedActionWithValue + 768
2 UIKit 0x000000020ee3bd74 630A7729-DCCE-311E-B6BF-226BFFD35685 + 736628
3 libdispatch.dylib 0x00000001053a8028 _dispatch_call_block_and_release + 24
4 libdispatch.dylib 0x00000001053a9860 _dispatch_client_callout + 16
5 libdispatch.dylib 0x00000001053b09bc _dispatch_lane_serial_drain + 688
6 libdispatch.dylib 0x00000001053b1634 _dispatch_lane_invoke + 424
7 libdispatch.dylib 0x00000001053bd158 _dispatch_workloop_worker_thread + 696
8 libsystem_pthread.dylib 0x00000001d97acb50 _pthread_wqthread + 284
9 libsystem_pthread.dylib 0x00000001d97ac67c start_wqthread + 8
)
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
There can be lots of logs file and it may be hard to send it by mail if not zipped.
I know that for Android, this library is using logback which can have a built in RollingFileAppender
.
But we should maybe be able ton configure it in javascript side
I've updated to v0.5.2
and there's a console.log on this line that is flooding my tests with undesirable messages.
Is this really necessary?
in Android we are able send email to multiple recipients by passing value in To
parameters as '[email protected],[email protected]'
but in iOS it's only allowing to send email to one recipient
So if possibles add support for iOS . So we can send email to multiple recipients
const sendLogFilesByEmail = () => {
FileLogger.sendLogFilesByEmail({
to: '[email protected],[email protected]',
subject: 'Log files',
body: 'Please find attached the log files from your app',
});
};
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.