Within the rake task I have both Rails.logger and p commands
If I run the task via command line bin/rake quickbooks:renew_oauth2_token I see the output in the console and in the log/development.log.
I am running crono as a daemon but none of my logger output shows up in log/crono.log nor log/development.log.
This is all that is recorded in log/crono.log
I, [2017-08-11T08:22:44.237388 #3867] INFO -- : Perform QboRenewTokens
I, [2017-08-11T08:22:44.238103 #3867] INFO -- : Finished QboRenewTokens in 0.00 seconds
I, [2017-08-11T08:27:44.237794 #3867] INFO -- : Perform QboRenewTokens
I, [2017-08-11T08:27:44.238448 #3867] INFO -- : Finished QboRenewTokens in 0.00 seconds
Originally created by @minimul on GitHub (Aug 11, 2017).
I am running a rake task within `config/cronotab.rb` e.g.
```ruby
# config/cronotab.rb
require 'rake'
Rails.app_class.load_tasks
class QboRenewTokens
def perform
Rake::Task['quickbooks:renew_oauth2_tokens'].invoke
end
end
Crono.perform(QboRenewTokens).with_options(truncate_log: 100).every 5.minutes
```
Within the rake task I have both `Rails.logger` and `p` commands
If I run the task via command line `bin/rake quickbooks:renew_oauth2_token` I see the output in the console and in the `log/development.log`.
I am running crono as a daemon but none of my logger output shows up in `log/crono.log` nor `log/development.log`.
This is all that is recorded in `log/crono.log`
```
I, [2017-08-11T08:22:44.237388 #3867] INFO -- : Perform QboRenewTokens
I, [2017-08-11T08:22:44.238103 #3867] INFO -- : Finished QboRenewTokens in 0.00 seconds
I, [2017-08-11T08:27:44.237794 #3867] INFO -- : Perform QboRenewTokens
I, [2017-08-11T08:27:44.238448 #3867] INFO -- : Finished QboRenewTokens in 0.00 seconds
```
To limit/control the output to the log file, in the perform function, I used: Crono.logger.level=:warn, using the appropriate log level defined in section 2.2 of https://guides.rubyonrails.org/debugging_rails_applications.html.
The Crono::Logging is a standard Ruby logging wrapper. If there is a better place to put this code (or even this reply), then please let me know. Thanks for documenting this, minimul, and for this gem, plashchynski. It's very helpful.
@firrib commented on GitHub (Aug 31, 2020):
To limit/control the output to the log file, in the `perform` function, I used: `Crono.logger.level=:warn`, using the appropriate log level defined in section 2.2 of https://guides.rubyonrails.org/debugging_rails_applications.html.
The Crono::Logging is a standard Ruby logging wrapper. If there is a better place to put this code (or even this reply), then please let me know. Thanks for documenting this, `minimul`, and for this gem, `plashchynski`. It's very helpful.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Originally created by @minimul on GitHub (Aug 11, 2017).
I am running a rake task within
config/cronotab.rbe.g.Within the rake task I have both
Rails.loggerandpcommandsIf I run the task via command line
bin/rake quickbooks:renew_oauth2_tokenI see the output in the console and in thelog/development.log.I am running crono as a daemon but none of my logger output shows up in
log/crono.lognorlog/development.log.This is all that is recorded in
log/crono.log@minimul commented on GitHub (Aug 12, 2017):
Solution: Use
Crono.logger.(info|warn|error)instead ofRails.logger.*@firrib commented on GitHub (Aug 31, 2020):
To limit/control the output to the log file, in the
performfunction, I used:Crono.logger.level=:warn, using the appropriate log level defined in section 2.2 of https://guides.rubyonrails.org/debugging_rails_applications.html.The Crono::Logging is a standard Ruby logging wrapper. If there is a better place to put this code (or even this reply), then please let me know. Thanks for documenting this,
minimul, and for this gem,plashchynski. It's very helpful.