Hi guys,
Below is my application.rb, Im trying to test Log API and Application Init
require 'rho'
require 'rho/rhoapplication'
class AppApplication Rho::RhoApplication
def initialize
# Tab items are loaded left->right, @tabs[0] is leftmost tab in the tab-bar
# Super must be called *after* settings @tabs!
@tabs = nil
#To remove default toolbar uncomment next line:
#@@toolbar = nil
super
# Uncomment to set sync notification callback to /app/Settings/sync_notify.
# SyncEngine::set_objectnotify_url("/app/Settings/sync_notify")
SyncEngine.set_notification(-1, "/app/Settings/sync_notify", '')
Rho::Log.info("App initialized", "Initial")
end
end
But I got this in rholog.txt:
I/APP ( 821): I 02/23/2015 20:58:31:381 0000034a APP| Application initialize failed: #;Trace: lib/rho/rho.rb:1383:in `const_missing'
I/APP ( 821): apps/app/application.rb:17:in `initialize'
1 Replies
Try taking out line 1, since it's not needed. Otherwise, I see nothing wrong with your code.
What version of Rhodes are you using?
I happen to be working on a new project, and so my application.rb is still very small. Here it is below in it's entirety, and the logging works just fine.
If it isn't due to line 1, you have a problem somewhere else. Maybe your build.yml. Do you get any error messages when you build?
Parenthesis for parameter lists are optional in Ruby. So, the only reason I don't use them below is because I don't like them.
require 'rho/rhoapplication'
class AppApplication < Rho::RhoApplication
def initialize
class_name = self.class.name
Rho::Log.info "--> #{__method__}", class_name
Rho::Log.info "Ruby version: #{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}", class_name
Rho::Log.info "$: = #{$:}", class_name
# Tab items are loaded left->right, @tabs[0] is leftmost tab in the tab-bar
# Super must be called *after* settings @tabs!
@tabs = nil
@@toolbar = nil # remove the default native toolbar
super
end
end