Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-4816

Add error handling to the logger

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 6.1.0
    • Affects Version/s: None
    • Component/s: Logging
    • Not Needed
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

      Description

      Add error handling to the logger, so that logging does not crash users applications unneccessarily. 

      • Errors coming from driver - want to ensure our processing never fails 
      • Errors coming from stream / user - want to ensure if they give us a stream that cannot be worked with, do not want to crash 

      Acceptance Criteria

      Implementation Requirements

      Client Options Error Handling

      • only crash when options of incorrect type (MongoClient.parseOptions will already handle this)
      • mongodbLogPath
        • If user stream crashes after construction
          • output a 'client' component log "mongodbLogPath stream is crashed, Logging is halted."
          • stop logging
        • if stderr has an error,
          • stop logging

      Driver Side Error Handling

      • Logger Class Methods
        • try/catch stringifyWithMaxLen
        • try/catch logDestination.write call
          • .then(onRejected) for async write
        • log
          • ensure if non-LoggableEvent input is provided, logger does not throw 
          • logs stringified input along with component and time
      • Ensure all properties needed for LoggableEvent (CommandStartedEvent, ConnectionPoolClosedEvent, etc..) construction are defined on class at time of construction + are of correct types 
      • Review all constructors of LoggableEvents and  ensure none of them throw an exception explicitly 

      Testing Requirements

      • Add unit tests for each case outlined here

       

        There are no Sub-Tasks for this issue.

            Assignee:
            aditi.khare@mongodb.com Aditi Khare
            Reporter:
            andy.mina@mongodb.com Andy Mina
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: