drush icon indicating copy to clipboard operation
drush copied to clipboard

Using --tail on drush ws should provide results tailed as json format

Open Shwele opened this issue 3 years ago • 2 comments
trafficstars

Describe the bug When using --tail for --format=json results in PHP response instead of json response from the command.

To Reproduce drush ws --severity=0 --severity=1 --severity=2 --severity=3 --format=json --tail

Expected behavior Returning json format report as example without --tail:

{
    "311056675": {
        "wid": "311056675",
        "uid": "31",
        "type": "webform_civicrm",
        "message": "The CiviCRM \"participant create\" API returned the error: \"Empty participant status field(status_id). Please fill it.\" when called by function \"preSave\" on line 194 of wf_crm_webform_postpr",
        "severity": "error",
        "link": "",
        "location": "https:\/\/example.com\/nis_fef_sanremo",
        "referer": "https:\/\/example.com\/nis_fef_sanremo",
        "hostname": "xxx.xxx.xxx.xxx",
        "date": "10\/Nov 13:25"
    },

Actual behavior

 311056672  10/Nov 13:23  error  webform_civicrm  The CiviCRM "participant create" API returned the error: "Empty participant status field(status_id). Please fill it." when called by
                                                  function "preSave" on line 194 of wf_crm_webform_postpr
 311056675  10/Nov 13:25  error  webform_civicrm  The CiviCRM "participant create" API returned the error: "Empty participant status field(status_id). Please fill it." when called by
                                                  function "preSave" on line 194 of wf_crm_webform_postpr

Workaround Running without tail command, which gives PHP error to work with.

System Configuration

Q A
Drush version? 8.4.11
Drupal version? 7.81
PHP version 7.3.33
OS? Linux

Shwele avatar Nov 10 '22 14:11 Shwele

--tail and --json are inherently incompatible, as you'd never be able to emit the closing punctuation (} or more likely ]) if in "tail" mode. We could potentially interpret --json as JSONL, perhaps, and print complete JSON records for each log entry on a single line.

greg-1-anderson avatar May 31 '23 22:05 greg-1-anderson

JSONL sounds like a good approach to me.

weitzman avatar Jun 02 '23 15:06 weitzman