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?
--
Posted via http://www.ruby-forum.com/.
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
--
Posted via http://www.ruby-forum.com/.
Sijo Kg wrote:> 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") > > > > SijoWhen 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? -- Posted via http://www.ruby-forum.com/.
Hi Did you try the example I said. I tested it and working for console and server starting (Not passenger) Sijo -- Posted via http://www.ruby-forum.com/.
Sijo Kg wrote:> Hi > > Did you try the example I said. I tested it and working for console > and server starting (Not passenger) > > SijoYeah I got it working. Wish I could see the generated output to a logfile though. That would be useful -- Posted via http://www.ruby-forum.com/.
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
--
Posted via http://www.ruby-forum.com/.