Hello,

 

I've been working on https://issues.apache.org/jira/browse/FLUME-74, and
I've managed to get the information output in the pattern passed through
flume, however I have hit a bit of a blocker with the stack traces. The
new line escape characters are being displayed inline rather than being
used to format the event output into separate lines.

 

Here is my code for outputting the stack trace in the getBody method of
the log4j event adaptor:

 

    public byte[] getBody() {

 

        StringBuilder body = new StringBuilder(layout.format(evt));

 

        if(layout.ignoresThrowable()){

            String[] s = evt.getThrowableStrRep();

            if (s != null) {

                int len = s.length;

                for (int i = 0; i < len; i++) {

                    body.append(s[i]);

                    body.append(Layout.LINE_SEP);

                }

            }

        }

        

        return body.toString().getBytes();

    }

 

I realise that I am using the log4j layout's line separator between the
stack trace elements, which is why it's showing up in the log, but I
want to be able to include line separators in log events and have them
format flume's output.

 

So here is my question; is there an escape character that I can use to
tell flume to insert a line separator on output, or can I make the
source process the escape character to split the event into multiple
lines?

 

Regards

 

 

Chris



NOTICE: Cognito Limited. Benham Valence, Newbury, Berkshire, RG20 8LU.  UK. 
Company number 02723032.  This e-mail message and any attachment is 
confidential. It may not be disclosed to or used by anyone other than the 
intended recipient. If you have received this e-mail in error please notify the 
sender immediately then delete it from your system. Whilst every effort has 
been made to check this mail is virus free we accept no responsibility for 
software viruses and you should check for viruses before opening any 
attachments. Opinions, conclusions and other information in this email and any 
attachments which do not relate to the official business of the company are 
neither given by the company nor endorsed by it.

This email message has been scanned for viruses by Mimecast

Reply via email to