Problems with LOG

It's probably a begginers question...but, in a controller I have:

    logger = Logger.new(STDOUT)     logger.info "Testing logger at controller"

When running my app in my machine, I can see this log in log/development.log file.

When running in production, this log is not printed. Not even with "puts" ...

Info is the default level for Logger when running in production...so...Why can't I see my logs in production environmnent ? Any help ?

It's probably a begginers question...but, in a controller I have:

logger = Logger\.new\(STDOUT\)
logger\.info "Testing logger at controller"

When running my app in my machine, I can see this log in log/development.log file.

When running in production, this log is not printed. Not even with "puts" ...

I don't think STDOUT is connected to anything in particular in production (since typically the process will have detached from the terminal that launched it) If you just want to write to the standard log file why do you need to create your own logger?

Fred

What's the best way to initialize logger and where to do it ?

well..

To log a message from either a controller or a model, access the Rails logger instance with the logger method:

class HomeController < ActionController::Base   def index     logger.info 'informational message'   end end

From outside a controller or model, you can pass the logger instance or access it with the constant RAILS_DEFAULT_LOGGER. Since Rails 2.1, you can also access it with the shortcut Rails.logger.

In an initializer file, Rails.logger is the best way to log ?

thanks