5 Replies Latest reply on Dec 29, 2014 7:12 AM by Rituraj Sinha

    how to define handler in wildfly 8.1.0

    Rituraj Sinha Novice

      I am having a log file as jboss-console.log which is in  jboss.domain.log.dir  location ...i want to add this in the Periodic Rotating File Handlers similar as server.log ...below is the configuration i am trying to use

       

                      <periodic-rotating-file-handler name="jboss-console.log" autoflush="true">

                          <level name="ALL"/>

                          <formatter>

                              <named-formatter name="PATTERN"/>

                          </formatter>

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

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

                          <append value="true"/>

                      </periodic-rotating-file-handler>

       

      the problem starts when i try to start any of the application servers

      [Server:vert-1]     ("subsystem" => "logging"),

      [Server:vert-1]     ("periodic-rotating-file-handler" => "jboss-console.log")

      [Server:vert-1] ]): java.lang.IllegalArgumentException: JBAS014847: Could not find a path called 'jboss.domain.log.dir'

       

       

      not sure why its not able to find the path as jboss.domain.log.dir  whereas when i give relative path as jboss.domain.base.dir it gives no error but again when i provide the relative path as

      jboss.domain.base.dir/log ...i receive the same error ....can someone let me know how can i fix this issue ?

        • 1. Re: how to define handler in wildfly 8.1.0
          Jay SenSharma Master

          In domain mode "jboss.domain.log.dir" is available to the the host controller.   But the profiles based logging configurations are for JBoss servers (not for host controllers) so you should be rather using "jboss.server.log.dir"

           

                              <file relative-to="jboss.server.log.dir" path="jboss-console.log"/>
          
          • 2. Re: how to define handler in wildfly 8.1.0
            James Perkins Master

            What do you want logged to this file? Each server uses it's own jboss.server.log.dir relative-to directory and does not have access to the jboss.domain.log.dir. The process-controller and the host-controller use the jboss.domain.xxx.dir properties.

             

            --
            James R. Perkins

            • 3. Re: how to define handler in wildfly 8.1.0
              Rituraj Sinha Novice

              Thanks jay and james for replying ...


              what i am trying to do is very similar which we use to do in the older jboss-versions as
              LAUNCH_JBOSS_IN_BACKGROUND=1 JBOSS_PIDFILE=$JBOSS_PIDFILE $JBOSS_HOME/bin/domain.sh > $JBOSS_BASE_DIR/log/jboss-console.log 2>&1 &

               

              the above log file gives us the detail info for all the application-servers running on that host ...and we need not to go in each of server.log specifically...but the problem is wrt to rotate the log it looks as if the descriptor is still alive and we are not able to rotate it ...

              • 4. Re: Re: how to define handler in wildfly 8.1.0
                Jay SenSharma Master

                     You are just redirecting the STDOUT  generated via the domain.sh  to a file "$JBOSS_BASE_DIR/log/jboss-console.log 2>&1 &".    In this case WildFly/Java process does not have control over the file "jboss-console.log".  As this file is actually generated by Operating System redirect utility ">"  , I am afraid that in this case you may need to be dependent on the OS level utilities like "logrotate"  [1]

                 

                 

                 

                The STDOUT entries of domain controller is actually controlled by the "wildfly-8.1.0.Final/domain/configuration/logging.properties",  like if you want to run the Host Controller in TRACE mode then you will need to edit this file and set it to TRACE level as following:

                 

                # Root logger level
                logger.level=${jboss.boot.server.log.level:TRACE}
                # Root logger handlers
                logger.handlers=BOOT_FILE,CONSOLE
                

                 

                Similarly you can control those host controller loggings and CONSOLE loggings using this file "logging.properties".  Refer to [2] for more detailed informations on WildFly logging:

                 

                [1] http://linuxconfig.org/setting-up-logrotate-on-redhat-linux

                [2] Logging Configuration - WildFly 8 - Project Documentation Editor

                1 of 1 people found this helpful
                • 5. Re: how to define handler in wildfly 8.1.0
                  Rituraj Sinha Novice

                  Thanks for the reply Jay...
                  To rotate the log i mentioned above i have applied the below handler...and now its working as expected for me

                   

                   

                              <periodic-rotating-file-handler name="jboss-console.log" autoflush="true">
                                  <level name="ERROR"/>
                                  <formatter>
                                      <named-formatter name="PATTERN"/>
                                  </formatter>
                                  <file relative-to="jboss.domain.base.dir" path="log/jboss-console.log"/>
                                  <suffix value=".yyyy-MM-dd"/>
                                  <append value="true"/>
                              </periodic-rotating-file-handler>

                  and

                   

                              <root-logger>
                                  <level name="INFO"/>
                                  <handlers>
                                      <handler name="CONSOLE"/>
                                      <handler name="FILE"/>
                                      <handler name="jboss-console.log"/>
                                  </handlers>
                              </root-logger>

                   

                   

                   

                  by doing these 2 changes i am able to rotate my jboss-console.log file as below
                  -rw-rw-r--. 1 jboss jboss 103862 Dec 29 05:42 jboss-console.log

                  -rw-rw-r--. 1 jboss jboss 273497 Dec 28 23:52 jboss-console.log.2014-12-27

                  -rw-rw-r--. 1 jboss jboss  92056 Dec 29 03:00 jboss-console.log.2014-12-28


                  -Rituraj