views:

207

answers:

2

I currently have a controller were I would like to keep track of logging in a separate log file, like: tracker.log. I currently get about 100,000 hits a day with this, and I would like to separate the log from all the other controllers so I can easily debug those as well as the tracker.

I couldn't find anything for the Rails::Initializer, that would extend specifically for a controller.

I know it will be something along the lines of:

config.log_path = 'log/tracker.log'

Although you can't re-run the Rails initializer mid load, right?

+1  A: 

AFAIK rails can't maintain two separate log file simultaneously. I'd recommend doing your own logging in the controller in question.

In similar situations I've used log4r. It's very easy to get started.

Gordon Wilson
+1  A: 

You just need to create your own instance of the Logger class (which is used by Rails to generate log files) and pass it a File instance as an argument.

More to see here.

Milan Novota