Rails.logger is nil when invoking rake tasks

Good morning everybody,

is it expected for the Rails.logger to be left uninitialized before
executing a rake task?
These are the steps to reproduce my test:

Thanks

On Tuesday, February 18, 2014 10:35:26 AM UTC, maurizio de magnis wrote:

Good morning everybody,

is it expected for the Rails.logger to be left uninitialized before
executing a rake task?
These are the steps to reproduce my test:
Rails.logger is nil when invoking rake tasks [Ruby: 2.1.0p0, Rails: 4.0.2] · GitHub

With a task like that, the rails environment is not loaded, so I
wouldn’t
expect much in the way of rails to be setup. If you set your task to
depend
on the :environment task then Rails should be setup for you.

Fred

On Tuesday, February 18, 2014 11:51:54 AM UTC+1, Frederick C. wrote:

Rails.logger is nil when invoking rake tasks [Ruby: 2.1.0p0, Rails: 4.0.2] · GitHub

With a task like that, the rails environment is not loaded, so I wouldn’t
expect much in the way of rails to be setup. If you set your task to depend
on the :environment task then Rails should be setup for you.

Thanks, I’ve updated the gist :slight_smile: