Logging Framework for ionic application


#1

Hi,
Is there any logging mechanism recommended or used for ionic 3 apps developed for ios, browser and android platforms?

Is console.log itself provides the logging for android /ios application?

Thanks,
K. Lakshmanan


#2

What exactly do you want to log and where?

console.log can also be viewd for iOS and Android with remote debugging on dev apps:
Follow these instructions for Safari dev tools: https://ionic.zone/debug/remote-debug-your-app#ios
Follow these instructions for Chrome dev tools: https://ionic.zone/debug/remote-debug-your-app#android


#3

@Sujan12
I am new to app development. Earlier in embed project, for reporting any errors to the developer, logs will be captured in text file and it is used for any future validation.

Is logging in chrome /safari can be taken and shared it to the developer for validation?

Thanks,
K. lakshmanan


#4

console.log is only accessible during development by default. It is a debugging tool to be used by the developer.

What you want seems to be some kind of error reporting.

Unfortunately users can’t just copy any files from the app and send them to the developer. But:

  • For the native part services like HockeyApp offer crash reporting (when the app crashes a log files is created that is sent to HockeyApp at the next start of the app).
  • For the Javascript part people use tools like Sentry or Rollbar to capture the console output (and errors) and submit them to the service where the developer then can look at them.

#5

@Sujan12
Is putting console.log() in the application or add during the debugging?

I am able to add log.info or log.debug using log4ts package, and configured the loglevels as info.

Using cordova plugin file, write the logs to the file present in the application directory.

I want something like i.e write those logs to the system logs. Any suggestion on the same?
would like to know where system log file will be located for android or ios? Will they allow app to write own log?

From the device logs, i would like to filter using tag what i provided…


#6

Here’s a simple file logger for Ionic 2+

Full disclosure: I am the developer