Log4j 2
  1. Log4j 2
  2. LOG4J2-455

RingBufferLogEvent should use Messsage timestamp first

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0-beta9
    • Fix Version/s: None
    • Component/s: Appenders
    • Labels:
      None

      Description

      When AsyncLogger received log message (method

       public void log(final Marker marker, final String fqcn, final Level level, final Message data,
                  final Throwable t)
      

      ), currently it uses

      clock.currentTimeMillis()
      

      (see at Line 221) as the timestamp.

      But it should check the message implements TimestampMessage or not, if yes, should use TimestampMessage.getTimestamp() as the timestamp, if not , then using clock.currentTimeMillis().

      The new Code:

      data instanceof TimestampMessage ? ((TimestampMessage) data ).getTimestamp() : clock.currentTimeMillis();
      

        Activity

        robin zhang tao created issue -
        robin zhang tao made changes -
        Field Original Value New Value
        Description When AsyncLogger received log message (method public void log(final Marker marker, final String fqcn, final Level level, final Message data,
                    final Throwable t)), currently it uses clock.currentTimeMillis() (see at Line 221) as the timestamp.

        But it should check the message implements TimestampMessage or not, if yes, should use TimestampMessage.getTimestamp() as the timestamp, if not , then using clock.currentTimeMillis().

        The new Code:

        data instanceof TimestampMessage ? ((TimestampMessage) data ).getTimestamp() : clock.currentTimeMillis();

        When AsyncLogger received log message (method
        {code}
         public void log(final Marker marker, final String fqcn, final Level level, final Message data,
                    final Throwable t)
        {code}
        ), currently it uses
        {code}
        clock.currentTimeMillis()
        {code}
         (see at Line 221) as the timestamp.

        But it should check the message implements TimestampMessage or not, if yes, should use TimestampMessage.getTimestamp() as the timestamp, if not , then using clock.currentTimeMillis().

        The new Code:
        {code}
        data instanceof TimestampMessage ? ((TimestampMessage) data ).getTimestamp() : clock.currentTimeMillis();
        {code}
        Remko Popma made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Assignee Remko Popma [ remkop@yahoo.com ]
        Resolution Fixed [ 1 ]
        robin zhang tao made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Remko Popma
            Reporter:
            robin zhang tao
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development