I created a “config/initializers/tasks.rb”
In it I have the following is all:
logger.info(“Running tasks”)
However nothing is logged or run. Am I missing something?
I created a “config/initializers/tasks.rb”
In it I have the following is all:
logger.info(“Running tasks”)
However nothing is logged or run. Am I missing something?
Hi
You have to specify where to log for example if want to console
vcan do like
logger = Logger.new(STDOUT)
logger.info(“Running tasks”)
Sijo
Sijo Kg wrote:
Hi
You have to specify where to log for example if want to console
vcan do likelogger = Logger.new(STDOUT)
logger.info(“Running tasks”)Sijo
When I do a “script/console” the initializers run. But when I fire up
the web server/rails (passenger) they don’t appear to run. Any ideas?
Hi
Did you try the example I said. I tested it and working for console
and server starting (Not passenger)
Sijo
Hi
You can do it like
Suppose you have a logfile say my_log_file.log in log folder Then
file = File.open(‘log/my_log_file.log’, ‘a’)
logger = Logger.new(file)
logger.info(“Running tasks”)
Sijo
And you need not create it It will be created automatically for you
Sijo
Sijo Kg wrote:
Hi
Did you try the example I said. I tested it and working for console
and server starting (Not passenger)Sijo
Yeah I got it working. Wish I could see the generated output to a
logfile though. That would be useful
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs