Details

    • Type: Improvement Improvement
    • Status: In Progress
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: proton-c, proton-j
    • Labels:
      None

      Description

      Applications that use Proton sometimes want Proton to produce logging.

      Goals
      ====

      • Proton should provide a default logging implementation.
      • It should be easy for Proton client code to provide custom logging implementation, e.g. one that uses the same third party logging framework as their application code.
      • Proton should not have a compile-time dependency on a third party logging framework
      • Proton's log output is considered to be part of its public interface. Therefore, in the spirit of Proton's cross-language consistency goals, this output should be consistent between proton-c and proton-j.
      • The goals that general-purpose logging frameworks try to meet - performance, ease of use etc - also apply.

        Issue Links

          Activity

          Hide
          Philip Harvey added a comment -

          Skeleton implementation of a proton-j ("operational") logging design, intended to act as a "straw man" when discussing the design.

          Show
          Philip Harvey added a comment - Skeleton implementation of a proton-j ("operational") logging design, intended to act as a "straw man" when discussing the design.
          Hide
          Philip Harvey added a comment - - edited

          Here are some rough notes about how the code should look that I agreed with Robbie and Rob. The previously-attached patch will be modified in line with the notes below.

          //Applications can plug in custom behaviour in several ways:
          
          engineFactory.setEngineLogger(myCustomEngineLogger)
          
          engineFactory.setEngineLogger(new CategoryLoggerWrapper(myCustomCategoryLogger))
          
          CategoryLoggerWrapper.setDefaultCategoryLogger(myCustomCategoryLogger)
          
          connection.setEngineLogger(myCustomEngineLogger)
          ((CategoryLoggerWrapper)connection.getEngineLogger()).setCategoryLogger(myCustomCategoryLogger)
          
          // How the new JMS client will probably do it:
          class JMSConnectionImpl
          {
              CategoryLoggerWrapper.setDefaultCategoryLogger(new Slf4JCategoryLogger()); // defined in Proton
          }
          
          
          // public class defined in proton-api
          public class CategoryLoggerWrapper implements EngineLogger, MessengerLogger...
          {
              private static final JUL_CATEGEORY_LOGGER = new JulCategoryLogger()
          	
          	private CategoryLogger _categoryLogger = JUL_CATEGEORY_LOGGER // or use the logger defined in a system property if set
          	
              static setDefaultCategoryLogger(logger);
             
              setCategoryLogger(logger)
          
              logFrameReceived(Connection, ....)
          	{
          		_categoryLogger.log(FRAME_CATEGORY, "blah blah")
          	}
          	
          	logMessengerStuff(...)
          }
          
          // used by Python tests
          public class RememberingLogger implements EngineLogger
          {
             ... just remembers its invocations so we can assertion correct behaviour of ConnectionImpl
          }
          
          
          class EngineFactoryImpl
          {
              public Connection createConnection()
              {
                  conn = return new ConnectionImpl(_engineLogger);
              }
          }
             
          class SenderImpl
          {
             ...
             getEngineLogger().logStuff(getConnection(), ....)
          }
          
          Show
          Philip Harvey added a comment - - edited Here are some rough notes about how the code should look that I agreed with Robbie and Rob. The previously-attached patch will be modified in line with the notes below. //Applications can plug in custom behaviour in several ways: engineFactory.setEngineLogger(myCustomEngineLogger) engineFactory.setEngineLogger( new CategoryLoggerWrapper(myCustomCategoryLogger)) CategoryLoggerWrapper.setDefaultCategoryLogger(myCustomCategoryLogger) connection.setEngineLogger(myCustomEngineLogger) ((CategoryLoggerWrapper)connection.getEngineLogger()).setCategoryLogger(myCustomCategoryLogger) // How the new JMS client will probably do it: class JMSConnectionImpl { CategoryLoggerWrapper.setDefaultCategoryLogger( new Slf4JCategoryLogger()); // defined in Proton } // public class defined in proton-api public class CategoryLoggerWrapper implements EngineLogger, MessengerLogger... { private static final JUL_CATEGEORY_LOGGER = new JulCategoryLogger() private CategoryLogger _categoryLogger = JUL_CATEGEORY_LOGGER // or use the logger defined in a system property if set static setDefaultCategoryLogger(logger); setCategoryLogger(logger) logFrameReceived(Connection, ....) { _categoryLogger.log(FRAME_CATEGORY, "blah blah" ) } logMessengerStuff(...) } // used by Python tests public class RememberingLogger implements EngineLogger { ... just remembers its invocations so we can assertion correct behaviour of ConnectionImpl } class EngineFactoryImpl { public Connection createConnection() { conn = return new ConnectionImpl(_engineLogger); } } class SenderImpl { ... getEngineLogger().logStuff(getConnection(), ....) }
          Hide
          ASF subversion and git services added a comment -

          Commit 1501276 from Philip Harvey
          [ https://svn.apache.org/r1501276 ]

          PROTON-343: initial implementation of logging, including the central class ProtonLogger
          and category logger implementations for java.util.logging (the default), standard out and SLF4J.
          Still to do:

          • Implementations in proton-jni and proton-c
          • Define the full set of logging functions in EngineLogger et al.
          • Modify existing Proton classes to actually use the new logging classes.
          Show
          ASF subversion and git services added a comment - Commit 1501276 from Philip Harvey [ https://svn.apache.org/r1501276 ] PROTON-343 : initial implementation of logging, including the central class ProtonLogger and category logger implementations for java.util.logging (the default), standard out and SLF4J. Still to do: Implementations in proton-jni and proton-c Define the full set of logging functions in EngineLogger et al. Modify existing Proton classes to actually use the new logging classes.
          Hide
          ASF subversion and git services added a comment -

          Commit 1501318 from Philip Harvey
          [ https://svn.apache.org/r1501318 ]

          PROTON-343: temporarily remove SLF4JCategoryLogger until the SLF4J dependency can be added to the CMake build

          Show
          ASF subversion and git services added a comment - Commit 1501318 from Philip Harvey [ https://svn.apache.org/r1501318 ] PROTON-343 : temporarily remove SLF4JCategoryLogger until the SLF4J dependency can be added to the CMake build
          Hide
          ASF subversion and git services added a comment -

          Commit 1501734 from Philip Harvey
          [ https://svn.apache.org/r1501734 ]

          PROTON-343: moved JUL and SLF4J loggers to proton-logging module, and made StdOutCategoryLogger
          the default (and adding configurability to it).

          Show
          ASF subversion and git services added a comment - Commit 1501734 from Philip Harvey [ https://svn.apache.org/r1501734 ] PROTON-343 : moved JUL and SLF4J loggers to proton-logging module, and made StdOutCategoryLogger the default (and adding configurability to it).
          Hide
          Philip Harvey added a comment -

          As of now, most of the logging framework code has been implemented but is not yet being used. Here is my list of what needs to be done to achieve this:

          • Implement the main methods we need on EngineLogger. These are currently:
            • sentFrame
            • receivedFrame
            • sentBytes
            • receivedBytes (replacing java.util.Logger in FrameParser)
            • possibly from SASL-related state information, e.g. saslOutcome(outcome)
            • possibly from SSL-related state information, e.g. sslDetected(true)
          • Add a new Frame interface to proton-api for use by EngineLogger.sendFrame
          • Replace uses of ProtocolTracer with EngineLogger. These are currently :
            • _protocolTracer.sentFrame(TransportFrame) in FrameWriter
            • _protocolTracer.receivedFrame(TransportFrame) in TransportImpl
          • Implement one or more DriverLogger onError() (or similar) methods to replace the existing use of java.util.logging
          Show
          Philip Harvey added a comment - As of now, most of the logging framework code has been implemented but is not yet being used. Here is my list of what needs to be done to achieve this: Implement the main methods we need on EngineLogger. These are currently: sentFrame receivedFrame sentBytes receivedBytes (replacing java.util.Logger in FrameParser) possibly from SASL-related state information, e.g. saslOutcome(outcome) possibly from SSL-related state information, e.g. sslDetected(true) Add a new Frame interface to proton-api for use by EngineLogger.sendFrame Replace uses of ProtocolTracer with EngineLogger. These are currently : _protocolTracer.sentFrame(TransportFrame) in FrameWriter _protocolTracer.receivedFrame(TransportFrame) in TransportImpl Implement one or more DriverLogger onError() (or similar) methods to replace the existing use of java.util.logging
          Hide
          ASF subversion and git services added a comment -

          Commit 1515455 from Philip Harvey in branch 'proton/trunk'
          [ https://svn.apache.org/r1515455 ]

          PROTON-343: Removed proton-logging module and its usages (all of which are functionally insignificant),
          so that the upcoming Proton 0.5 release does not contain this not-yet-prime-time module.

          Show
          ASF subversion and git services added a comment - Commit 1515455 from Philip Harvey in branch 'proton/trunk' [ https://svn.apache.org/r1515455 ] PROTON-343 : Removed proton-logging module and its usages (all of which are functionally insignificant), so that the upcoming Proton 0.5 release does not contain this not-yet-prime-time module.
          Hide
          ASF subversion and git services added a comment -

          Commit 1547827 from rhs@apache.org in branch 'proton/trunk'
          [ https://svn.apache.org/r1547827 ]

          PROTON-343: added logging callback for proton-c

          Show
          ASF subversion and git services added a comment - Commit 1547827 from rhs@apache.org in branch 'proton/trunk' [ https://svn.apache.org/r1547827 ] PROTON-343 : added logging callback for proton-c
          Hide
          ASF subversion and git services added a comment -

          Commit 1548123 from rhs@apache.org in branch 'proton/trunk'
          [ https://svn.apache.org/r1548123 ]

          PROTON-343: added transport context

          Show
          ASF subversion and git services added a comment - Commit 1548123 from rhs@apache.org in branch 'proton/trunk' [ https://svn.apache.org/r1548123 ] PROTON-343 : added transport context

            People

            • Assignee:
              Philip Harvey
              Reporter:
              Philip Harvey
            • Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:

                Development