13 Replies Latest reply on Jun 9, 2012 7:30 AM by Evgeny Vovchenko

    newb question : Logging / Debugging

      I read the page on doing logging/debugging but cannot seem to get any PUTS or log statements to show up on the console or in my rholog.txt file.

       

      I'm sure I am missing something simple here.

       

       

      This is a callback on an HTTP processor.   The show_error/show_results page will be displayed (if I change/comment the RhoLog.Error call) so I know we are getting to this point in the code.   However if I use puts, rholog.error, app_info, or app_error I can seem to get the test string to show up anywhere.   My guess is I'm looking in the wrong file(s)/console or have missed a config setting to enable this.

       

        def httpget_callback

          if @params['status'] != 'ok'

              @@error_params = @params

              WebView.navigate((url_for :action => :show_error))       

          else

            @@get_result = @params["body"]

       

            begin

              require "rexml/document"

       

              doc = REXML::Document.new(@@get_result)

              puts "doc : #{doc}"

            rescue Exception => e

              puts "Error: #{e}"

              @@get_result = "Error: #{e}"

            end

            Rholog.Error("category","************ MESS ****************")

            WebView.navigate( url_for(:action => :show_result) )

          end

          Rholog.Error("category","************ MESS 22 ****************")

          WebView.navigate((url_for :action => :show_result))

        end

       

       

      My rhoconfig.txt:

       

      # Rhodes log properties

      # log level

      # 0-trace, 1-info(app level), 3-warnings, 4-errors

      # for production set to 3

      MinSeverity  = 0

       

      # enable copy log messages to standard output, useful for debugging

      LogToOutput = 1

       

      # '*' means all categories, otherwise list them : Cat1, Cat2

      LogCategories = *

       

      # what categories to exclude

      ExcludeLogCategories =

        • Re: newb question : Logging / Debugging
          Darryn Campbell

          Hi,  Which device / platform are you developing on?

            • Re: newb question : Logging / Debugging

              On windows 7 32-bit using Eclipse w/ JDK 1.6.0_32 developing for Android HTC Incredible OS v2.2 (level 8).

                • Re: newb question : Logging / Debugging
                  Darryn Campbell

                  If you go to http://docs.rhomobile.com/rhodes/build and search for "getting the application log from device or emulator" you should find the answer in that section, thanks.

                    • Re: newb question : Logging / Debugging

                      Hi Darryn -

                       

                      Thanks for the clues.

                       

                      The remote object (logging text file) does not exist.   I can't seem to get this to be created regardless of my settings in the rhoconfig file. 

                       

                      # Rhodes log properties

                      # log level

                      # 0-trace, 1-info(app level), 3-warnings, 4-errors

                      # for production set to 3

                      MinSeverity  = 1

                       

                      # enable copy log messages to standard output, useful for debugging

                      LogToOutput = 1

                       

                      # '*' means all categories, otherwise list them : Cat1, Cat2

                      LogCategories = *

                       

                      # what categories to exclude

                      ExcludeLogCategories =

                       

                      # max log file size in Bytes, set 0 to unlimited size; when limit is reached, log wraps to beginning of file

                      MaxLogFileSize= 0

                       

                       

                      Output from the rake pull of the log from the device...

                       

                       

                      c:\Users\Musiplicity WinDev\Documents\Dutchbulb\Dutchbulb>rake device:android:getlog

                      cd C:/MotorolaRhoMobileSuite2.0.5/ruby/lib/ruby/gems/1.9.1/gems/rhodes-3.3.3

                      $app_config['extensions'] : ["json", "another-extension"]

                      $app_config['capabilities'] : ["gps"]

                      $vendor = rhomobile >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

                      $app_package_name = com.rhomobile.dutchbulb >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

                      NDK sysroot: C:/Android/android-ndk-r8/platforms/android-9/arch-arm

                      PWD: C:/MotorolaRhoMobileSuite2.0.5/ruby/lib/ruby/gems/1.9.1/gems/rhodes-3.3.3

                      CMD: C:/Android/android-sdks/platform-tools/adb.exe -d pull /data/data/com.rhomobile.dutchbulb/rhodata/RhoLog.txt "c:/Users/Musiplicity WinDev/Documents/Dutchbulb/Dutchbulb"

                       

                      remote object '/data/data/com.rhomobile.dutchbulb/rhodata/RhoLog.txt' does not exist

                       

                      RhoLog.txt stored to c:/Users/Musiplicity WinDev/Documents/Dutchbulb/Dutchbulb

                       

                       

                       

                      Any other clues?

                       

                       

                      - L

                        • Re: newb question : Logging / Debugging
                          Darryn Campbell

                          hmmm... I've never used the product on Android so I'm not the expert... but I thought the log should also be output to logcat, do you see anything at logcat?. 

                           

                          To see all the device messages, run adb -d logcat and start the application on your device.

                            • Re: newb question : Logging / Debugging

                              I see a ton of output but NOT my asterisk lines:

                               

                                puts "************* STORELOCATIONS **************"
                                app_info "*** STORE LOCATIONS ***"

                               

                               

                              ...and yes, this section of code is being hit.

                                • Re: newb question : Logging / Debugging
                                  Robert Galvin

                                  Can you try app_error in place of app_info?

                                  1 of 1 people found this helpful
                                    • Re: newb question : Logging / Debugging

                                      OK, that is bizarre.   I am doing this in the code...

                                       

                                        puts "************* STORELOCATIONS **************"
                                        app_info "*** STORE LOCATIONS ***"
                                        app_error "*** SL error ***"

                                       

                                       

                                      And now I am getting ALL THREE lines of logging output!!!

                                       

                                      I/APP (18659): I 06/08/2012 16:59:23:959 00004911              APP| ************* STORELOCATIONS **************

                                       

                                      I/APP (18659): I 06/08/2012 16:59:23:959 00004911 APP StoresController| *** STORE LOCATIONS ***

                                       

                                      I/APP (18659): E 06/08/2012 16:59:23:960 00004911 APP StoresController| *** SL error ***

                                       

                                       

                                      Baffling, but at least I'm getting somewhere.  I wonder if I can take out the app_error now and still see my app_info output.     

                                       

                                      Could adding in app_error have triggered something in the build process?   Turning on a config flag possibly?     I've been trying to get those other 2 lines to show up for the past 27 builds!

                                       

                                      Either way I can at least get output now, thanks!

                                        • Re: newb question : Logging / Debugging
                                          Robert Galvin

                                          Sounds like this may be a bug. Thanks for troubleshooting and providing the details. I will alert the team on the issue.

                                            • Re: newb question : Logging / Debugging

                                              I am not getting output with just app_info()

                                               

                                              However I am new to Eclipse, Ruby, and Rhostudio so it is possible this was coming out in the log before but I simply wasn't finding it.    Though a routine ^f search in the console window was not locating the output, which is fairly rudimentary IDE/debug process stuff.

                                               

                                               

                                              Thanks again for your help, Rob.    

                                               

                                              I'm really liking what I see with Rho* over any other cross-platform mobile frameworks.    It is MUCH faster than anything else we've used even though the underlying principles and concepts are the same.  

                                               

                                              Phonegap + JQM, for  example, is VERY laggy on the Android UI.      Rhomobile, same technique is MUCH more responsive.    The bytecode engine seems to be very well done.     If this  passes the litmus test with the GPS Droid/IOS apps we will be launching some very prominent services based on the platform by end-of-summer.     

                                               

                                              Looks promising.  I'm hoping to be giving the entire Rho team props in my annual "state of mobile development" presentation this October.