FastSolutions
FastSolutions

Reputation: 1829

Default Rails Path to Environment Log File

I'm creating a rotating logger for my staging and production environment. So I've written the following code:

config.logger = Logger.new(config.log_path, 2 , 'daily')

Now my question is how do you get the log_path, can you dynamically link it depending on the current env? My logs are located in log/ (default path I think) and the file is staging.log / production.log depending on te env.

Kind regards

Upvotes: 2

Views: 2750

Answers (1)

FastSolutions
FastSolutions

Reputation: 1829

Found this quick fix solution:

Rails.root.join('log',"#{Rails.env}.log")

Wondering if there's a better one.

Upvotes: 2

Related Questions