onOffice-Web-Org / oo-wp-plugin

onOffice for WP-Websites
https://wp-plugin.onoffice.com
GNU General Public License v3.0
9 stars 9 forks source link

Error log is cut off #412

Closed jmaas-onoffice closed 1 year ago

jmaas-onoffice commented 1 year ago

Only part of the request is shown

I can provoke an API error by adding a custom field to a field list and then deleting that custom field in enterprise. In the logs, I then get this:

[09-Jan-2023 15:42:06 UTC] PHP Fatal error:  Uncaught The API returned an error with code error code 141 and the following message:
Unknown field: ind_1952_Feld_ObjZusatz52

The request that caused this error was:

{
    "actionid": "urn:onoffice-de-ns:smart:2.5:smartml:action:read",
    "resourceid": "",
    "resourcetype": "estate",
    "parameters": {
        "data": [
            "multiParkingLot",
            "ind_1952_Feld_ObjZusatz52",
            "virtualAddress",
            "objektadresse_freigeben",
            "reserviert",
            "verkauft",
            "vermarktungsart",
            "virtualStreet",
            "virtualHouseNumber",
            "laengengrad",
            "breitengrad",
            "virtualLatitude",
            "virtualLongitude",
            "strasse",
            "showGoogleMap",
            "hausnummer",
            "objekttitel",
            "objektart",
            "ort",
            "objektnr_extern",
            "plz",
            "land",
            "Id"
        ],
        "filter": {
            "veroeffentli in /www/htdocs/w01bb2af/testinstanz-jmaa.onofficeweb.com/htdocs/wp-content/plugins/onoffice-for-wp-websites/plugin/API/APIClientExceptionFactory.php on line 53

As described in #395, the error should look more like this with the entire request shown:

The API returned an error with code 141 and the following message:
Unknown field: ind_1834_Feld_ObjFreitexte20

The request that caused this error was:
{
    "actionid": "urn:onoffice-de-ns:smart:2.5:smartml:action:read",
    "resourceid": "",
    "resourcetype": "estate",
    "parameters": {
        "data": [
            "objekttitel",
            "objektart",
            "objekttyp",
            "vermarktungsart",
            "objektnr_extern",
            "ind_1834_Feld_ObjFreitexte20",
            "Id"
        ],
        "filter": {
            "veroeffentlichen": [
                {
                    "op": "=",
                    "val": 1
                }
            ],
            "Id": [
                {
                    "op": "=",
                    "val": 35
                }
            ]
        },
        "estatelanguage": "DEU",
        "outputlanguage": "DEU",
        "listlimit": 1,
        "formatoutput": true,
        "addMainLangId": true,
        "listoffset": 0
    }
}

onOffice\WPlugin\API\ApiClientException in /var/www/html/wp-content/plugins/onoffice-for-wp-websites/plugin/API/APIClientExceptionFactory.php:53
Stack trace:
…

In the code, the message is set correctly: https://github.com/onOffice-Web-Org/oo-wp-plugin/blob/f8863db12c399b6650864544feb244c683b9ed5c/plugin/API/ApiClientException.php#L74

I am not sure why the message is being cut off when displayed in the logs.

Redundant "error code"

Additionally, the first line reads "an error with code error code 141". This should be corrected, for example in #395 we proposed "an error with code 141".

hungnc89 commented 1 year ago

https://serverfault.com/questions/256459/nginx-php-fpm-long-log-lines-get-truncated Like in this article, maybe it is the cause of issue, log_errors_max_len parametter, I will increase it to see if it works

jmaas-onoffice commented 1 year ago

I don't think it is an option to change runtime parameters.

However, the documentation for log_errors_max_len mentions that the limit is not applied "to explicitly called functions such as error_log()". So maybe currently the error is logged because it is an uncaught exception, so you might be able to add a way to catch it and log the error with error_log().

dai-eastgate commented 1 year ago

@jmaas-onoffice Now I don't know what is the cause and I tried to reproduce but can't reproduce the error. I think the memory is full, so when the exception runs, the content of the exception breaks midway. Can you help me reproduce it?

jmaas-onoffice commented 1 year ago

This is what I did:

  1. Add a custom field to enterprise.
  2. Use that custom field in an estate list.
  3. Delete the custom field from enterprise.
  4. This should give you the error form the issue description.
dai-eastgate commented 1 year ago

@jmaas-onoffice I have followed the steps as you described but my error log is still showing full. You can watch my video,

https://user-images.githubusercontent.com/106214469/217478278-41a65e59-8518-4e1c-8d06-d90eabb3c16e.mp4

jmaas-onoffice commented 1 year ago

Yes, that looks different! I will have a look if I can still reproduce it, thanks!

jmaas-onoffice commented 1 year ago

For documentation: It seems that with PHP 8 I also cannot reproduce this problem.