How generate a log.text file which holds app logs in nativescript angular2?


#1

Hi,

I want to maintain a log file for my application which holds the entire logs (like log,info, warn and error) of the application.
Whenever the application is installed on device that time log file also need to create in particular location and all the logs of application should need to write on that file automatically.
For this how should i achieve?

Thanks in advance.


#2

Isnt it better if you create a Database in MySQL or in MongoDB to write the log information there?


#3

Thanks @PurpleRune
I have planned the app should work with offline as well as online. So i decided for local Sqlite database and for Master Oracle database.
Once i create and store the log file in local means i will update it with central when device in online. For all of this, initially i need to create log file, i have stucked with that only.


#4

@kumaran makes sense what you said i guess.
I dont really know how to hold app logs, but i made a quick google search, maybe this will help you?


#5

@kumaran I went down the path of trying to log to a file and have decided to log to sqlite instead. The reason is as of now, I don’t know of a way to append text to a file in nativescript. I don’t quite understand why your use case wouldn’t allow for the app to create a sqlite db on install and then log to it? The app I’m working on is also online offline where the database syncs certain tables when online, but this doesn’t seem like a barrier to writing logs to it. We have a support type page in the app where a user can then upload the sqlite database to our server with a support ticket.