Code Monkey home page Code Monkey logo

Comments (4)

lulalala avatar lulalala commented on August 23, 2024

I assume this works in development and not in production?

Can you find the class name of Rails.logger?

from multi_logger.

srochan avatar srochan commented on August 23, 2024

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?

from multi_logger.

lulalala avatar lulalala commented on August 23, 2024

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

from multi_logger.

srochan avatar srochan commented on August 23, 2024

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

from multi_logger.

Related Issues (9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.