Feature #12580

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

Added by Mike Cantelon 6 months ago. Updated about 1 month ago.

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

0%

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

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 6 months ago

  • Status changed from New to Code Review

#2 Updated by Mike Cantelon 6 months ago

  • Assignee deleted (Mike Cantelon)

#3 Updated by Steve Breker 6 months 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 6 months ago

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

#5 Updated by Mike Cantelon 6 months ago

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

#6 Updated by Steve Breker 6 months ago

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

Looks good Mike!

#7 Updated by Mike Cantelon 6 months 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 5 months ago

  • Target version set to Release 2.5.0

#9 Updated by David Juhasz about 1 month ago

  • Assignee changed from Dan Gillean to Mike Cantelon

Mike, please add a sample script for testing.

#10 Updated by Mike Cantelon about 1 month 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 1 month 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.

Also available in: Atom PDF