Uploaded image for project: 'Log4php'
  1. Log4php
  2. LOG4PHP-208

Add ability to pass more information to the MongoDB logger

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Duplicate
    • None
    • None
    • Code

    Description

      I'm using my logger in a distributed environment and really need another available field for MongoDB, called jobID, so I can tie a queued job to the logged event.

      I think it could be handled with something like:

      public function log( LoggerLevel $level, $message, $throwable = null, $extras = array('jobId' => new MongoId('foo123'), 'foo' => 'bar') )
      
      {
        _id: ObjectId("51c08aca162d280300000000"),
        jobId: ObjectId("foo123"),
        foo: 'bar', 
        timestamp: ISODate("2013-06-18T16:28:58.017Z"),
        level: "ERROR",
        thread: 3,
        message: "User: xxx has no API credentials.",
        loggerName: "main",
        fileName: "/app/admin/protected/components/xxx.php",
        method: "_setApi",
        lineNumber: 86,
        className: "xxx"
      }
      

      I tried to extend the Logger package to build this in, but I found it rather un-extensible. I ended up extending pretty much all the files, which at that point, may as well just edit the core files.

      Thanks

      Attachments

        Activity

          People

            juice Ivan Habunek
            bthibault Brian Thibault
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 8h
                8h
                Remaining:
                Remaining Estimate - 8h
                8h
                Logged:
                Time Spent - Not Specified
                Not Specified