Friday, 27 September 2013

RAILS: outputting to file is formatting differently on staging when compared to local

RAILS: outputting to file is formatting differently on staging when
compared to local

I am printing some data to a custom log file. It works well. However, when
I pushed the application to the staging server from my local dev
environment, the way it printed the data to file changed. Locally, each
print would go on a new line like so:
log
log
log
However, when pushing to the staging dev server the log started printing
like this:
logloglog



This is the code I am currently using:
print eco_logger.info("Date: " + Time.now.strftime("%I:%M:%S") + " | " +
"User: " + current_user.email.to_s() + " | " + "Action: Edited User |
User: " + @user.first_name.to_s + " " + @user.last_name.to_s + " | Email:
" + @user.email.to_s)
I also tried the \n, to see if that would work; like so:
print eco_logger.info("\nDate: " + Time.now.strftime("%I:%M:%S") + " | " +
"User: " + current_user.email.to_s() + " | " + "Action: Edited User |
User: " + @user.first_name.to_s + " " + @user.last_name.to_s + " | Email:
" + @user.email.to_s)
Locally, it added another space so things were like this:
log
log
log
However, at staging things remained the same....tis a grim day.
Would anyone be able to shed some light on this issue? Thanks!

No comments:

Post a Comment