Uploaded image for project: 'Flume'
  1. Flume
  2. FLUME-2387

Flume log4j appender stacktrace handling

    Details

      Description

      Hello,

      I'm using log4j flume appender in a tomcat webapp to send log lines to a flume avro source. Everything seems to work fine for "normal" log lines however calls like:

      logger.error("Exception: ", e); 
      

      seem to ignore the stacktrace (throwable) so the only thing I get on the other side is the "Exception: " string. I tried the same code with console and file log4j appenders and the stacktraces are printed properly.

      I would appreciate any ideas/suggestion about why I can't get them with the flume log4j appender?

      I've noticed that both console and file appenders are extending org.apache.log4j.WriterAppender->org.apache.log4j.AppenderSkeleton while flume appender extends org.apache.log4j.AppenderSkeleton only.

      This is my log4j.xml

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE log4j:configuration PUBLIC "-//APACHE//DTD LOG4J 1.2//EN" "log4j.dtd">
      <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
      
          <!-- Appenders -->
          <appender name="console" class="org.apache.log4j.ConsoleAppender">
              <param name="Target" value="System.out" />
              <layout class="org.apache.log4j.PatternLayout">
                  <param name="ConversionPattern" value="%t %-5p %c{2} - %m%n" />
              </layout>
          </appender>
          
          <appender name="flume"       class="org.apache.flume.clients.log4jappender.Log4jAppender">
                   <param name="Hostname" value="localhost"/>
                   <param name="Port" value="4545"/>
                   <param name="UnsafeMode" value="true"/>
              <layout class="org.apache.log4j.PatternLayout">
                <param name="ConversionPattern" value="%t %-5p %c{2} - %m%n"/>
              </layout>
          </appender>
          
          <appender name="file" class="org.apache.log4j.FileAppender">
              <param name="File" value="/tmp/util.log" />
              <param name="Append" value="true" />
              <layout class="org.apache.log4j.PatternLayout">
                <param name="ConversionPattern" value="%t %-5p %c{2} - %m%n"/>
              </layout>
           </appender>
          
      
          <!-- Root Logger -->
          <root>
              <priority value ="info" />
              <appender-ref ref="console" />
              <appender-ref ref="flume" />
              <appender-ref ref="file" />
          </root>
          
      </log4j:configuration>
      
      

      Thank you!
      Nick

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              nicktgr15 Nikolaos Tsipas
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: