Feature #12580

Add option to log execution of scripts using the tools:run task

Added by Mike Cantelon over 3 years ago. Updated about 2 years ago.

Status:VerifiedStart date:11/22/2018
Priority:MediumDue date:
Assignee:-% Done:

100%

Category:CLI tools
Target version:Release 2.5.0
Google Code Legacy ID: Tested version:
Sponsored:No Requires documentation:

Description

During imports which involve a lot of custom scripts running it can be easy to lose track of what's run and when. Add --log option to log script runs.

History

#1 Updated by Mike Cantelon over 3 years ago

  • Status changed from New to Code Review

#2 Updated by Mike Cantelon over 3 years ago

  • Assignee deleted (Mike Cantelon)

#3 Updated by Steve Breker over 3 years ago

  • Status changed from Code Review to Feedback
  • Assignee set to Mike Cantelon

See comment on PR: just wondering if it should allow an optional filename to be specified. Thinking of a use case where I might be running a CLI task multiple times perhaps in a script - might like to specify the log name on the command line.

#4 Updated by Mike Cantelon over 3 years ago

I've added a --log_file option to specify a log filename other than the default.

#5 Updated by Mike Cantelon over 3 years ago

  • Status changed from Feedback to Code Review
  • Assignee changed from Mike Cantelon to Steve Breker

#6 Updated by Steve Breker over 3 years ago

  • Status changed from Code Review to Feedback
  • Assignee changed from Steve Breker to Mike Cantelon

Looks good Mike!

#7 Updated by Mike Cantelon over 3 years ago

  • Status changed from Feedback to QA/Review
  • Assignee changed from Mike Cantelon to Dan Gillean
  • Requires documentation set to Yes

Merged into qa/2.5.x.

#8 Updated by Dan Gillean over 3 years ago

  • Target version set to Release 2.5.0

#9 Updated by David Juhasz about 3 years ago

  • Assignee changed from Dan Gillean to Mike Cantelon

Mike, please add a sample script for testing.

#10 Updated by Mike Cantelon about 3 years ago

  • Assignee deleted (Mike Cantelon)

This capability is useful for situations where a complex import, using logs of different scripts, is being done and the developer wants to keep track of what scripts have been run when.

Below are some testing instructions. Change into the AtoM root directory to test.

Download my example script:

curl -L https://bit.ly/2Iei9rD > script_example.php

To run the script you can enter:

./symfony tools:run script_example.php

To test running this script and logging to the default log file:

./symfony tools:run script_example.php --log

The above example should create (or append to, if it already exists) the file log/tools_run.log.

To test running script script and logging to a non-default log file (in this case: tools.log):

./symfony tools:run script_example.php --log --log_file=tools.log

The above example should create (or append to, if it already exists) the file tools.log.

#11 Updated by Michelle Curran about 3 years ago

  • Status changed from QA/Review to Verified
  • Assignee set to Michelle Curran

VERIFIED
Awesome, Mike! Thanks for the testing instructions and sample script. I added another and tested. Fix looks good.

#12 Updated by Dan Gillean about 2 years ago

  • Assignee deleted (Michelle Curran)
  • % Done changed from 0 to 100
  • Requires documentation deleted (Yes)

Also available in: Atom PDF