Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deployment #16

Open
srochan opened this issue Jun 9, 2017 · 4 comments
Open

Deployment #16

srochan opened this issue Jun 9, 2017 · 4 comments

Comments

@srochan
Copy link

srochan commented Jun 9, 2017

I am trying to deploy my rails app as a war on jboss. However, I keep getting an error saying that the logger I use in multi_logger is an undefined method of logger.

I use Rails.logger.<my_logger>.info
and I get an error saying
Undefined method <my_logger>

@lulalala
Copy link
Owner

lulalala commented Jun 9, 2017

I assume this works in development and not in production?

Can you find the class name of Rails.logger?

@srochan
Copy link
Author

srochan commented Jun 13, 2017

This is not working even in development.

The classname is ActiveSupport::Logger is on rails console. How can I check the value on the deployed app?

@lulalala
Copy link
Owner

It should work if it is ActiveSupport::Logger. I think you may have forgotten to set it in an initializer.

For deployed app, just enter its production console, and puts Rails.logger.class

@srochan
Copy link
Author

srochan commented Jun 13, 2017

Here is my initializer
formatter = Proc.new{|severity, time, progname, msg|
formatted_severity = sprintf("%-5s",severity.to_s)
formatted_time = time.strftime("%Y-%m-%d %H:%M:%S")
caller_trace=caller.clone
caller_trace.delete_if {|x| x.include?"logger" or x.include? "lgg"}
callee = caller_trace[0].split("/").last
"[#{formatted_severity} #{formatted_time} #{callee}] #{msg.to_s.strip}\n"
}

MultiLogger.add_logger('my_app', formatter:formatter)

if Rails::env == 'production'
Rails.logger.my_app.level = Logger::INFO
end

I have used Rails.logger.my_app.info, etc in my code

I got an error saying that logger has no method called my_app

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants