1 Reply Latest reply on May 12, 2015 5:25 PM by James Perkins

    Is it possible to get request header information into JBoss logging

    Anthony Nguyen Newbie

      With JBoss 7

      In the past I've success fully extracted a field from my request headers to be put in our access-logs with with a syntax like so: %{hostName}i

       

      Anyone know of a quick and easy way to put header field into my regular logs?  I tried adding it to the pattern-formatter as a shot in the dark but at runtime it says that's not a valid parameter.  I'd like every syserr logged line to have the hostname field which is in the header of my Rest calls coming into my jboss rest api.

       

      <subsystem xmlns="urn:jboss:domain:logging:1.1">

                  <console-handler name="CONSOLE">

                      <level name="INFO"/>

                      <formatter>

                          <pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n %{hostName}i"/>

                      </formatter>

                  </console-handler>

                  <periodic-rotating-file-handler name="FILE">

                      <formatter>

                          <pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n tony %{hostName}i"/>

                      </formatter>

                      <file relative-to="jboss.server.log.dir" path="server.log"/>

                      <suffix value=".yyyy-MM-dd"/>

                      <append value="true"/>

                  </periodic-rotating-file-handler>