Forum Cross Platform with Xamarin

How to create a log file in xamarin cross platform app?

I m working on a cross platform app (android and ios ). My requirement is to create a .txt LOG file which should be saved in the device itself (most of the time app will be running offline ). Log file should save all the exceptions which occur during the life time of the App?



  • AlessandroCaliaroAlessandroCaliaro ITMember ✭✭✭✭✭
    I think you can simply use a text file. Implement open and write on platform specific prj and unse dependencyservice in pcl to use it

    Or PclStorage

    I don't know if something like nlog works
  • ClintStLaurentClintStLaurent USUniversity ✭✭✭✭✭

    Serilog is a Xamarin compatible Nuget that gives lots of logging options. It has a concept of "sink" as output target. You can add a 'sink' to save to file, a sink for save to database, a sink for send email and a lot more.

  • mirzashahbazmirzashahbaz INMember

    @ClintStLaurent Can u please send me an example code or something which should work in pcl . I cannot figure out how to implement serilog in xamarin . Thanks

Sign In or Register to comment.