title: Logback : append log message to outputstream appender
body: <p>I'm using Logback framework v1.0.1 to do logging. I would like to know how to append the log message to an outputstream in java. </p>
  
  <p>I wanted to format the log message into key=value pairs At the end i want to getformatted log message as an output stream. I retrieved the logger instance and log the message at debug level.</p>
  
  <pre><code>    ch.qos.logback.classic.Logger logger = (ch.qos.logback.classic.Logger)      LoggerFactory.getLogger("SplunkSearch.SplunkLogger");
      logger.info( "wrap = true, setValue = false,");
      logger.debug( "wrap = true, setValue = false,");
  
  
  The logback.xml configuration file is as follows : 
  
  &lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;configuration debug="true"&gt;
  
  &lt;timestamp key="bySecond" datePattern="yyyyMMdd'T'HHmmss"         timeReference="contextBirth"/&gt;
  
   &lt;contextName&gt;splunksearchcontext&lt;/contextName&gt;
  
   &lt;appender name="stdout" class="ch.qos.logback.core.ConsoleAppender"&gt;
    &lt;Target&gt;System.out&lt;/Target&gt;
    &lt;encoder&gt;
       &lt;pattern&gt;%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n&lt;/pattern&gt;
    &lt;/encoder&gt;
    &lt;/appender&gt;
  
    &lt;appender name= "outputstream" class="ch.qos.logback.core.OutputStreamAppender"&gt;
    &lt;encoder&gt;
    &lt;pattern&gt;&lt;/pattern&gt;
   &lt;/encoder&gt;
   &lt;/appender&gt;
  
   &lt;root level="debug"&gt;
   &lt;appender-ref ref="stdout"/&gt;
   &lt;appender-ref ref="outputstream" /&gt;
    &lt;/root&gt;
   &lt;/configuration&gt;
  </code></pre>
  
  <p>The output is as follows when i run.</p>
  
  <p>i saw this line in the status message that is sort of error. No outputstream set.</p>
  
  <p>15:07:19,399 |-ERROR in ch.qos.logback.core.OutputStreamAppender[outputstream] - No<br>
  output stream set for the appender named "outputstream".</p>
  
  <p>15:07:19.414 [main] INFO  SplunkSearch.SplunkLogger - wrap = true, setValue = false,</p>
  
  <p>15:07:19.430 [main] DEBUG SplunkSearch.SplunkLogger - wrap = true, setValue = false, </p>