Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-31920

Runtime Errors to be logged into .err file

    XMLWordPrintable

Details

    Description

      • All run-time errors or unhandled exceptions from within a Function should be logged to an application specific .err file.
      • The file should reside in the same directory as the .log file(that contains all messages being printed via log() statements)
      • The rotation policy for the .err file should be similar to that of .log file (inherit it)
      • Lifecycle and management of the .err file should be the same as .log files.

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            chanabasappa.ghali Chanabasappa Ghali added a comment - - edited

            Srinivasan Raman below is the logs captured for errors. 

             

            2021-04-20T21:15:24.118-07:00 [INFO]

            {"count":1,"exception":"\"URIError: URI malformed\"","file":"myErrFunc.js","line":47,"since":"2021-04-20T21:15:24","srcLine":"uri = encodeURI(' uDFFF')","stack":"URIError: URI malformed\n at encodeURI (<anonymous>)\n at triggerUriError (myErrFunc.js:48:11)\n at OnUpdate (myErrFunc.js:17:9)"}

            2021-04-20T21:15:24.118-07:00 [INFO] {"count":1,"exception":"\"TypeError: \\\"String\\\" is not a constructor\"","file":"myErrFunc.js","line":37,"since":"2021-04-20T21:15:24","srcLine":"let e = new 'String'","stack":"TypeError: \"String\" is not a constructor\n at triggerTypeError (myErrFunc.js:38:13)\n at OnUpdate (myErrFunc.js:13:9)"}

            2021-04-20T21:14:38.296-07:00 [INFO] "Doc created/updated" "07-triggerUriError"

            2021-04-20T21:14:23.285-07:00 [INFO] "Doc created/updated" "05-triggerTypeError"

            2021-04-20T21:14:21.113-07:00 [INFO] {"count":1,"exception":"\"SyntaxError: Unexpected token b in JSON at position 2\"","file":"undefined","line":0,"since":"2021-04-20T21:14:21","srcLine":"

            { bad json }

            ","stack":"SyntaxError: Unexpected token b in JSON at position 2\n at JSON.parse (<anonymous>)\n at triggerBadJsonParse (myErrFunc.js:33:21)\n at OnUpdate (myErrFunc.js:11:9)"}

            2021-04-20T21:14:01.485-07:00 [INFO] "Doc created/updated" "03-triggerBadJsonParse"

            2021-04-20T21:12:15.102-07:00 [INFO] {"count":1,"exception":"\"ReferenceError: a is not defined\"","file":"myErrFunc.js","line":22,"since":"2021-04-20T21:12:15","srcLine":"a = 10","stack":"ReferenceError: a is not defined\n at triggerReferenceError01 (myErrFunc.js:23:7)\n at OnUpdate (myErrFunc.js:7:9)"}

            2021-04-20T21:11:47.286-07:00 [INFO] "Doc created/updated" "01-triggerReferenceError-0002_"

            2021-04-20T21:10:09.094-07:00 [INFO] {"count":1,"exception":"\"RangeError: Invalid array length\"","file":"myErrFunc.js","line":42,"since":"2021-04-20T21:10:09","srcLine":"let hugeArray = Array(Number.MAX_VALUE);","stack":"RangeError: Invalid array length\n at triggerRangeError (myErrFunc.js:43:21)\n at OnUpdate (myErrFunc.js:15:9)"}

            2021-04-20T21:09:59.085-07:00 [INFO] "Doc created/updated" "06-triggerRangeError"

            2021-04-20T21:07:00.081-07:00 [INFO] {"count":1,"exception":"\"ReferenceError: a is not defined\"","file":"myErrFunc.js","line":22,"since":"2021-04-20T21:07:00","srcLine":"a = 10","stack":"ReferenceError: a is not defined\n at triggerReferenceError01 (myErrFunc.js:23:7)\n at OnUpdate (myErrFunc.js:7:9)"}

            2021-04-20T21:06:15.687-07:00 [INFO] "Doc created/updated" "01-triggerReferenceError"

            chanabasappa.ghali Chanabasappa Ghali added a comment - - edited Srinivasan Raman  below is the logs captured for errors.    2021-04-20T21:15:24.118-07:00 [INFO] {"count":1,"exception":"\"URIError: URI malformed\"","file":"myErrFunc.js","line":47,"since":"2021-04-20T21:15:24","srcLine":"uri = encodeURI(' uDFFF')","stack":"URIError: URI malformed\n at encodeURI (<anonymous>)\n at triggerUriError (myErrFunc.js:48:11)\n at OnUpdate (myErrFunc.js:17:9)"} 2021-04-20T21:15:24.118-07:00 [INFO] {"count":1,"exception":"\"TypeError: \\\"String\\\" is not a constructor\"","file":"myErrFunc.js","line":37,"since":"2021-04-20T21:15:24","srcLine":"let e = new 'String'","stack":"TypeError: \"String\" is not a constructor\n at triggerTypeError (myErrFunc.js:38:13)\n at OnUpdate (myErrFunc.js:13:9)"} 2021-04-20T21:14:38.296-07:00 [INFO] "Doc created/updated" "07-triggerUriError" 2021-04-20T21:14:23.285-07:00 [INFO] "Doc created/updated" "05-triggerTypeError" 2021-04-20T21:14:21.113-07:00 [INFO] {"count":1,"exception":"\"SyntaxError: Unexpected token b in JSON at position 2\"","file":"undefined","line":0,"since":"2021-04-20T21:14:21","srcLine":" { bad json } ","stack":"SyntaxError: Unexpected token b in JSON at position 2\n at JSON.parse (<anonymous>)\n at triggerBadJsonParse (myErrFunc.js:33:21)\n at OnUpdate (myErrFunc.js:11:9)"} 2021-04-20T21:14:01.485-07:00 [INFO] "Doc created/updated" "03-triggerBadJsonParse" 2021-04-20T21:12:15.102-07:00 [INFO] {"count":1,"exception":"\"ReferenceError: a is not defined\"","file":"myErrFunc.js","line":22,"since":"2021-04-20T21:12:15","srcLine":"a = 10","stack":"ReferenceError: a is not defined\n at triggerReferenceError01 (myErrFunc.js:23:7)\n at OnUpdate (myErrFunc.js:7:9)"} 2021-04-20T21:11:47.286-07:00 [INFO] "Doc created/updated" "01-triggerReferenceError-0002_" 2021-04-20T21:10:09.094-07:00 [INFO] {"count":1,"exception":"\"RangeError: Invalid array length\"","file":"myErrFunc.js","line":42,"since":"2021-04-20T21:10:09","srcLine":"let hugeArray = Array(Number.MAX_VALUE);","stack":"RangeError: Invalid array length\n at triggerRangeError (myErrFunc.js:43:21)\n at OnUpdate (myErrFunc.js:15:9)"} 2021-04-20T21:09:59.085-07:00 [INFO] "Doc created/updated" "06-triggerRangeError" 2021-04-20T21:07:00.081-07:00 [INFO] {"count":1,"exception":"\"ReferenceError: a is not defined\"","file":"myErrFunc.js","line":22,"since":"2021-04-20T21:07:00","srcLine":"a = 10","stack":"ReferenceError: a is not defined\n at triggerReferenceError01 (myErrFunc.js:23:7)\n at OnUpdate (myErrFunc.js:7:9)"} 2021-04-20T21:06:15.687-07:00 [INFO] "Doc created/updated" "01-triggerReferenceError"

            One more thing you may want to test explicitly:

            Simulate any of the above specific error cases multiple times. You should see error details being logged as you have captured above, with a count higher than 1.

            Thanks!

            srinivasan.raman Srinivasan Raman added a comment - One more thing you may want to test explicitly: Simulate any of the above specific error cases multiple times. You should see error details being logged as you have captured above, with a count higher than 1. Thanks!

            2021-04-20T22:01:21.242-07:00 [INFO] "Doc created/updated" "11-triggerReferenceError-0001" 
            2021-04-20T22:01:35.145-07:00 [INFO] "Doc created/updated" "11-triggerReferenceError-0002" 
            2021-04-20T22:02:22.285-07:00 [INFO] {"count":2,"exception":"\"ReferenceError: a is not defined\"","file":"myErrFunc.js","line":26,"since":"2021-04-20T22:02:22","srcLine":"a = 10","stack":"ReferenceError: a is not defined\n  at triggerReferenceError01 (myErrFunc.js:27:7)\n  at OnUpdate (myErrFunc.js:19:9)"}

            chanabasappa.ghali Chanabasappa Ghali added a comment - 2021-04-20T22:01:21.242-07:00 [INFO] "Doc created/updated" "11-triggerReferenceError-0001"  2021-04-20T22:01:35.145-07:00 [INFO] "Doc created/updated" "11-triggerReferenceError-0002"  2021-04-20T22:02:22.285-07:00 [INFO] {"count":2,"exception":"\"ReferenceError: a is not defined\"","file":"myErrFunc.js","line":26,"since":"2021-04-20T22:02:22","srcLine":"a = 10","stack":"ReferenceError: a is not defined\n  at triggerReferenceError01 (myErrFunc.js:27:7)\n  at OnUpdate (myErrFunc.js:19:9)"}

            People

              srinivasan.raman Srinivasan Raman
              venkatraman.subramanian Venkatraman Subramanian (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty