Hybrid View

  1. #1
    Sencha User
    Join Date
    May 2012
    Location
    Bangalore
    Posts
    95
    Vote Rating
    1
    Rameshlamani is on a distinguished road

      0  

    Default How to create txt file and also How to write all javascript exceptions to d same file

    How to create txt file and also How to write all javascript exceptions to d same file


    I want to log/write all javascript errors to one text file when ever an error happens in my JavaScript functions. using try catch block, i am catching exception. i need to log this exception to txt file. how can i achive this one sencha touch2


    How can I do that. Please help me.

  2. #2
    Sencha - Training Team mrsunshine's Avatar
    Join Date
    Sep 2008
    Location
    Germany - Darmstadt
    Posts
    690
    Vote Rating
    12
    mrsunshine will become famous soon enough

      0  

    Default


    you can not write it to a FILE cause your browser has no access to the file system. you can only write it to the browsers console with console.log()

  3. #3
    Sencha User
    Join Date
    May 2012
    Location
    Bangalore
    Posts
    95
    Vote Rating
    1
    Rameshlamani is on a distinguished road

      0  

    Default


    Thanq for your reply.

  4. #4
    Sencha User
    Join Date
    Jun 2011
    Posts
    46
    Vote Rating
    1
    gubarez is on a distinguished road

      0  

    Default


    You can also use localstorage... However, be aware, that if an iOS device has turned the private browsing on, you will be very likely to get lots of errors, and of course sencha to fail to load.

  5. #5
    Sencha User
    Join Date
    May 2012
    Location
    Bangalore
    Posts
    95
    Vote Rating
    1
    Rameshlamani is on a distinguished road

      0  

    Default


    Quote Originally Posted by gubarez View Post
    You can also use localstorage... However, be aware, that if an iOS device has turned the private browsing on, you will be very likely to get lots of errors, and of course sencha to fail to load.
    so what is the best solution for this one. can i store all log errors(Exception) in local storage and how?

  6. #6
    Sencha User rohdef's Avatar
    Join Date
    Mar 2010
    Location
    Aarhus, Denmark
    Posts
    67
    Vote Rating
    3
    rohdef is on a distinguished road

      0  

    Default


    When you want to get exceptions I would say that local storage is a really bad way, since you woudn't be able to retrieve those, unless you have the device.

    Much rather would I make some kind of remote service to which you can call and store your exceptions. If you are running the code on the same domain as the service you can use an ajax proxy for the purpose. If you have to run cross domain you'd have to do some tricks to make it work (probably making your own proxy).

    But basically a remote service that stores them in an database and then combined with some kind of gui to view them would probably be the easiest way.

    If you want to combine with the offline scenario you might be able to make a localstorage to cache it and then call the remote service when possible.
    Developer/Alien Technologies at Mobile Ambitions Aps, Denmark.

Thread Participants: 3

Tags for this Thread