3 Replies Latest reply on Aug 3, 2018 3:33 AM by Saša O

    Filter in wildfly log

    johnsi george Newbie

      Requirement :

                              To filter error message/exception into another log named errorlog.log other than server.log

      Configuration :

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

                  <level name="ERROR"/>

      <filter-spec value="match(&quot;UT005023:*&quot;)"/> 

                  <formatter>

                      <named-formatter name="PATTERN"/>

                  </formatter>

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

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

              </periodic-rotating-file-handler>

      <logger category="errortest" use-parent-handlers="false">

                      <level name="ERROR"/>

                      <handlers>

                          <handler name="CONSOLE"/>

                          <handler name="errorjohn"/>

                      </handlers>

                  </logger>

      Error In server Log:

      17:23:45,696 ERROR [io.undertow.request] (default task-4) UT005023: Exception ha

      ndling request to /Testsporacle/testing: java.lang.NoSuchMethodError: com.nfr.sv

       

      No error starting with UT005023: is logged in errorlog.log.

      ApplicationServer used: wildfly 10.0

        • 1. Re: Filter in wildfly log
          jaikiran pai Master

          <logger category="errortest"

          The category value should match the category of the logger which logs the message. In your example it either should be "io.undertow" or if you want specifically for undertow request logger category then it should be "io.undertow.request" (as you can see from the logged message).

          • 2. Re: Filter in wildfly log
            Saša O Newbie

            We recently moved from Wildfy 9 to Wildfly 13.

            After that we got a problem with log file size. It got much, much bigger.

            The problem is with logging SQL statements. Wildfy log all of the STL statements, although org.eclipse.persistence.sql was set to info.

            Then I changed org.eclipse.persistence.sql level to WARN but it didn't help.

            Log for SQL statment look like:

            2018-07-29 00:00:15,001 INFO  [stdout] (EJB default - 36) [EL Fine]: sql: 2018-07-29 00:00:15.001--ServerSession(1339863965)--Connection(717493262)--SELECT id...

             

            What should I change?

             

            Logging configuration:

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

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

                            <formatter>

                                <named-formatter name="PATTERN"/>

                            </formatter>

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

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

                            <append value="true"/>

                        </periodic-rotating-file-handler>

                        <logger category="com.arjuna">

                            <level name="WARN"/>

                        </logger>

                        <logger category="org.jboss.as.config">

                            <level name="DEBUG"/>

                        </logger>

                        <logger category="sun.rmi">

                            <level name="WARN"/>

                        </logger>

                        <logger category="org.eclipse.persistence.sql">

                            <level name="WARN"/>

                        </logger>

                        <logger category="org.jboss.as.jpa">

                            <level name="ERROR"/>

                        </logger>

                        <root-logger>

                            <level name="INFO"/>

                            <handlers>

                                <handler name="FILE"/>

                            </handlers>

                        </root-logger>

                        <formatter name="PATTERN">

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

                        </formatter>

                        <formatter name="COLOR-PATTERN">

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

                        </formatter>

                    </subsystem>

            • 3. Re: Filter in wildfly log
              Saša O Newbie

              Solved the problem.

              The problem was in persistence.xml.

              We had property:

              <property name="eclipselink.logging.logger" value="DefaultLogger" />

              <property name="eclipselink.logging.level.sql" value="FINEST" />

              <property name="eclipselink.logging.parameters" value="true" />

               

              This didn't affect log in Wildfly9, I guess that Wildfly9 log configuration had priority over persistence and that changed in some of new versions.

               

              Solution was to delete those properties from persistence.