You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flume.apache.org by "Mike Percy (Created) (JIRA)" <ji...@apache.org> on 2012/02/22 02:10:49 UTC

[jira] [Created] (FLUME-987) LoggerSink prints garbage for body

LoggerSink prints garbage for body
----------------------------------

                 Key: FLUME-987
                 URL: https://issues.apache.org/jira/browse/FLUME-987
             Project: Flume
          Issue Type: Bug
    Affects Versions: v1.0.0
            Reporter: Mike Percy
            Assignee: Mike Percy
            Priority: Minor
             Fix For: v1.1.0


The LoggerSink relies on Event.toString() being implemented, which is not reliable since it's not part of the Event interface (of course, it's part of Object and prints some memory address by default).

SimpleEvent implements toString() but poorly (prints the memory address for the body byte array), and other implementations of Event may not override toString().

I will submit a patch to remove the toString() method from SimpleEvent and implement a quick fix in LoggerSink.

Longer term, we may want to consider using something like MIME types via the headers so that decoding is more automatic and less reliant on the configured classes being fully cognizant of the data encoding.


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (FLUME-987) LoggerSink prints garbage for body

Posted by "Mike Percy (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FLUME-987?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13213179#comment-13213179 ] 

Mike Percy commented on FLUME-987:
----------------------------------

Thanks for the comment Brock! I'll mark this as a duplicate.
                
> LoggerSink prints garbage for body
> ----------------------------------
>
>                 Key: FLUME-987
>                 URL: https://issues.apache.org/jira/browse/FLUME-987
>             Project: Flume
>          Issue Type: Bug
>    Affects Versions: v1.0.0
>            Reporter: Mike Percy
>            Assignee: Mike Percy
>            Priority: Minor
>             Fix For: v1.1.0
>
>
> The LoggerSink relies on Event.toString() being implemented, which is not reliable since it's not part of the Event interface (of course, it's part of Object and prints some memory address by default).
> SimpleEvent implements toString() but poorly (prints the memory address for the body byte array), and other implementations of Event may not override toString().
> I will submit a patch to remove the toString() method from SimpleEvent and implement a quick fix in LoggerSink.
> Longer term, we may want to consider using something like MIME types via the headers so that decoding is more automatic and less reliant on the configured classes being fully cognizant of the data encoding.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (FLUME-987) LoggerSink prints garbage for body

Posted by "Mike Percy (Resolved) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FLUME-987?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mike Percy resolved FLUME-987.
------------------------------

    Resolution: Duplicate

duplicate of FLUME-828
                
> LoggerSink prints garbage for body
> ----------------------------------
>
>                 Key: FLUME-987
>                 URL: https://issues.apache.org/jira/browse/FLUME-987
>             Project: Flume
>          Issue Type: Bug
>    Affects Versions: v1.0.0
>            Reporter: Mike Percy
>            Assignee: Mike Percy
>            Priority: Minor
>             Fix For: v1.1.0
>
>
> The LoggerSink relies on Event.toString() being implemented, which is not reliable since it's not part of the Event interface (of course, it's part of Object and prints some memory address by default).
> SimpleEvent implements toString() but poorly (prints the memory address for the body byte array), and other implementations of Event may not override toString().
> I will submit a patch to remove the toString() method from SimpleEvent and implement a quick fix in LoggerSink.
> Longer term, we may want to consider using something like MIME types via the headers so that decoding is more automatic and less reliant on the configured classes being fully cognizant of the data encoding.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (FLUME-987) LoggerSink prints garbage for body

Posted by "jiraposter@reviews.apache.org (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FLUME-987?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13213173#comment-13213173 ] 

jiraposter@reviews.apache.org commented on FLUME-987:
-----------------------------------------------------


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/3994/
-----------------------------------------------------------

Review request for Flume.


Summary
-------

The LoggerSink currently prints the memory address of the Event's body, instead of the stringified value, which is because it relies on toString() being implemented in the Event implementation. The reason it prints the memory address is due to a bug in SimpleEvent's toString() method... however, SimpleEvent is not guaranteed to have a viable way to stringify its body contents in general.

I believe it makes sense to remove toString() from SimpleEvent and, with LoggingSink, assume that the body is always stringifiable and do the decoding based on the Event interface directly in the class.


This addresses bug FLUME-987.
    https://issues.apache.org/jira/browse/FLUME-987


Diffs
-----

  flume-ng-core/src/main/java/org/apache/flume/event/SimpleEvent.java e0c3b45 
  flume-ng-core/src/main/java/org/apache/flume/sink/LoggerSink.java f6f9d33 

Diff: https://reviews.apache.org/r/3994/diff


Testing
-------

Built and ran using LoggerSink and the body is properly printed.


Thanks,

Mike


                
> LoggerSink prints garbage for body
> ----------------------------------
>
>                 Key: FLUME-987
>                 URL: https://issues.apache.org/jira/browse/FLUME-987
>             Project: Flume
>          Issue Type: Bug
>    Affects Versions: v1.0.0
>            Reporter: Mike Percy
>            Assignee: Mike Percy
>            Priority: Minor
>             Fix For: v1.1.0
>
>
> The LoggerSink relies on Event.toString() being implemented, which is not reliable since it's not part of the Event interface (of course, it's part of Object and prints some memory address by default).
> SimpleEvent implements toString() but poorly (prints the memory address for the body byte array), and other implementations of Event may not override toString().
> I will submit a patch to remove the toString() method from SimpleEvent and implement a quick fix in LoggerSink.
> Longer term, we may want to consider using something like MIME types via the headers so that decoding is more automatic and less reliant on the configured classes being fully cognizant of the data encoding.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (FLUME-987) LoggerSink prints garbage for body

Posted by "Brock Noland (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FLUME-987?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13213174#comment-13213174 ] 

Brock Noland commented on FLUME-987:
------------------------------------

Hi,

I think this is a duplicate of FLUME-828. 

Brock
                
> LoggerSink prints garbage for body
> ----------------------------------
>
>                 Key: FLUME-987
>                 URL: https://issues.apache.org/jira/browse/FLUME-987
>             Project: Flume
>          Issue Type: Bug
>    Affects Versions: v1.0.0
>            Reporter: Mike Percy
>            Assignee: Mike Percy
>            Priority: Minor
>             Fix For: v1.1.0
>
>
> The LoggerSink relies on Event.toString() being implemented, which is not reliable since it's not part of the Event interface (of course, it's part of Object and prints some memory address by default).
> SimpleEvent implements toString() but poorly (prints the memory address for the body byte array), and other implementations of Event may not override toString().
> I will submit a patch to remove the toString() method from SimpleEvent and implement a quick fix in LoggerSink.
> Longer term, we may want to consider using something like MIME types via the headers so that decoding is more automatic and less reliant on the configured classes being fully cognizant of the data encoding.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (FLUME-987) LoggerSink prints garbage for body

Posted by "Mike Percy (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FLUME-987?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mike Percy updated FLUME-987:
-----------------------------

    Fix Version/s:     (was: v1.1.0)
    
> LoggerSink prints garbage for body
> ----------------------------------
>
>                 Key: FLUME-987
>                 URL: https://issues.apache.org/jira/browse/FLUME-987
>             Project: Flume
>          Issue Type: Bug
>    Affects Versions: v1.0.0
>            Reporter: Mike Percy
>            Assignee: Mike Percy
>            Priority: Minor
>
> The LoggerSink relies on Event.toString() being implemented, which is not reliable since it's not part of the Event interface (of course, it's part of Object and prints some memory address by default).
> SimpleEvent implements toString() but poorly (prints the memory address for the body byte array), and other implementations of Event may not override toString().
> I will submit a patch to remove the toString() method from SimpleEvent and implement a quick fix in LoggerSink.
> Longer term, we may want to consider using something like MIME types via the headers so that decoding is more automatic and less reliant on the configured classes being fully cognizant of the data encoding.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira