Comments (4)
I assume this works in development and not in production?
Can you find the class name of Rails.logger
?
from multi_logger.
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.
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.
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)
- Log not registering in production HOT 3
- 可以決定 logger class 嗎? HOT 1
- Problems on Heroku HOT 3
- Just curious: Why are you monckey patching the class instead of the logger instance? HOT 3
- undefined method `to_model' for true:TrueClass error HOT 2
- Tagged logger HOT 2
- Logger handles '-' in filename by replacing it with '_' HOT 2
- Problem with Heroku Push HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from multi_logger.