8 Replies Latest reply: Jul 9, 2013 2:47 PM by King Koopa RSS

how to configure custom log location in managed domain?

hsr Newbie

JBOSS Version: 7.1.0.CR1b

 

I have configured domain with two servers in it away from the jboss binary. The jboss is installed in /home/JBOSS/7.1.0 directory and my domain is confugred in /apps/TEST/jbossdomain. I am using domain.properties file where I have defined jboss.domain.base.dir and jboss.domain.config.dir properties. I have also defined property jboss.domain.log.dir which tells where to create log file. When I start the servers in domain, it picks up the configuration from jboss.domain.config.dir location,  however, logs are still being created at default location and not at  the location of jboss.domain.log.dir. 

 

How can I create log file at custom location?

  • 1. Re: how to configure custom log location in managed domain?
    Wolf-Dieter Fink Master

    Did you change

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

    within the logging subsystem of the correct profile in domain.xml?

  • 2. Re: how to configure custom log location in managed domain?
    hsr Newbie

    Thanks for reply. I did not try to change this property but earlier I tried to set a system property 'jboss.server.log.dir" in correct profile in server group section ( as shown below)

     

    <system-properties>

    <property name="jboss.server.log.dir" value="/logs/WSD/jbossdomain_7/managed "/>

    </system-properties>

     

    which obviously  did not work. Upon your suggestion I changed to the value and the log file was created at specified location as shown below:

     

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

     

     

    However this does not solve other problems. I have two two servers in this domain and  are to this profile. With this change both the servers are now logging to the same file and also 'boot.log' is still being logged at default location.

     

    is there not way that I can setup log file location for each server. Does this mean that I will need as many profiles as servers?

     

    i just wanted to find a way where I can setup custom location for all of server log files, which should be easy to configure but somehow I am not able to get it.


    Thanks again for the response.

  • 3. Re: how to configure custom log location in managed domain?
    Neven Cvetkovic Newbie

    James,

     

    Try redefining jboss.server.log.dir for each server, e.g.

     

        <servers>

            <server name="server-one" group="main-server-group">

                 <paths>

                     <path name="jboss.server.log.dir" path="/var/log/jbossdomain/serverone" />

                 </paths>

            </server>

            <server name="server-two" group="main-server-group" auto-start="true">

                <paths>

                    <path name="jboss.server.log.dir" path="/var/log/jbossdomain/servertwo" />

                </paths>

                <socket-bindings port-offset="150"/>

            </server>

            <server name="server-three" group="other-server-group" auto-start="false">

                <paths>

                    <path name="jboss.server.log.dir" path="/var/log/jbossdomain/serverthree" />

                </paths>

                <socket-bindings port-offset="250"/>

            </server>

        </servers>

     

    You should be able to redefine the path in your servers, according to https://docs.jboss.org/author/display/AS71/General+configuration+concepts

     

    Only (first five) the following entries are not allowed to be redefined:

    • jboss.home
    • user.home
    • user.dir
    • java.home
    • jboss.server.base.dir

     

    See if that helps.

  • 4. Re: how to configure custom log location in managed domain?
    Duncan Doyle Newbie

    This configuration is almost correct. You can't override the 'jboss.server.log.dir' in your server configuration as it is a reserved property. What you can do however is define a path with the name 'my.jboss.server.log.dir' in your server configuration (i.e. in your server config in your host-controller) and configure this as the 'relative-to' property of the '<file .....>' configuration of the logging subsystem in your profile (i.e. domain.xml).

     

    Hope this helps.

  • 5. Re: how to configure custom log location in managed domain?
    Neven Cvetković Newbie

    Thanks for clarification Duncan.

     

    I've quickly tested both my and your ideas:

     

    You are correct, we can't override "jboss.server.log.dir" in the domain.xml/host.xml.

     

    Your suggestion works great, but it doesn't completely solve our problem.

     

    Let's start with virgin install of JBoss AS7.

     

    By default, out-of-the-box, domain mode generates the following log files:

    1. JBOSS_HOME/domain/log/host-controller.log
    2. JBOSS_HOME/domain/log/process-controller.log
    3. JBOSS_HOME/domain/servers/server-one/log/server-one/log/boot.log
    4. JBOSS_HOME/domain/servers/server-one/log/server-one/log/server.log
    5. JBOSS_HOME/domain/servers/server-one/log/server-two/log/boot.log
    6. JBOSS_HOME/domain/servers/server-one/log/server-two/log/server.log

     

    Location of files (1) and (2) can be customized by adding lines to JBOSS_HOME/bin/domain.conf file:

     

    if [ "x$JBOSS_LOG_DIR" = "x" ]; then

        JBOSS_LOG_DIR=/tmp/jbossdomain/controllers     # host-controller.log and process-controller.log

    fi

     

     

    Location of files (4) and (6) can be customized by editing domain.xml and host.xml files (as Duncan suggested):

     

    JBOSS_HOME/domain/configuration/domain.xml:

      <profiles>

        <profile name="default">

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

            ...

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

              ...

              <file relative-to="custom.jboss.server.log.dir" path="server.log"/>      # server.log name is defined here

              ...

            </periodic-rotating-file-handler>

          </subsystem>

          ...

        </profile>

        ...

      </profiles>

     

     

    JBOSS_HOME/domain/configuration/host.xml:

      <servers>

        <server name="server-one" group="main-server-group">

          <paths>

            <path name="custom.jboss.server.log.dir" path="/tmp/jbossdomain/server-one" />

          </paths>

        </server>

        <server name="server-two" group="main-server-group" auto-start="true">

          <paths>

            <path name="custom.jboss.server.log.dir" path="/tmp/jbossdomain/server-two" />

          </paths>

          <socket-bindings port-offset="150"/>

        </server>

        <server name="server-three" group="other-server-group" auto-start="false">

          <paths>

            <path name="custom.jboss.server.log.dir" path="/tmp/jbossdomain/server-three" />

          </paths>

          <socket-bindings port-offset="250"/>

        </server>

      </servers>

     

     

    Of course, the "boot.log" is configured in the JBOSS_HOME/domain/configuration/logging.properties:

     

    handler.FILE.fileName=${org.jboss.boot.log.file:boot.log}

     

     

    We can write everything to a same boot.log file, but we can't configure the location of boot.log per appserver process.

     

    I need to play with this longer to figure out how to do this. It seems it is an overkill, but we could try passing in JVM OPTIONS for each JVM appserver, e.g. "-Dorg.jboss.boot.log.file=/tmp/jbossdomain/server-one/boot.log"

     

    Any suggestions?

  • 6. Re: how to configure custom log location in managed domain?
    Neven Cvetković Newbie

    Also,

     

    Take a look at the "ps -ef | grep java" and see what actually made it to JAVA_OPTS for 4 java processes (host-controller, process-controller, server-one, server-two).

     

    Cheers!

  • 7. Re: how to configure custom log location in managed domain?
    King Koopa Newbie

    Hello Neven & Folks,

    I  know its been a long time since there was a post on this thread.

    I wanted to know if you were able to figure out how to make boot.log and host-controller.log & process-controller.log configured to point to a custom location?

     

    I configured my Server.log location in JBOSS_HOME/domain/configuration/domain.xml:( And its WORKS !!!)

      <profiles>

        <profile name="default">

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

            ...

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

              ...

              <file relative-to="custom.jboss.server.log.dir" path="/tmp/logs/server.log"/>      # server.log name is defined here

              ...

            </periodic-rotating-file-handler>

          </subsystem>

          ...

        </profile>

        ...

      </profiles>

     

    For host-controller.log and process-controller.log , i made changes in the domain.sh file and it works fine but as soon as i touch boot.log , i made the change in the   JBOSS_HOME/domain/configuration/logging.properties:

     

    handler.FILE.fileName=${org.jboss.boot.log.file:/tmp/logs/boot.log},

    the process and host log files disappear

     

     

    Any help in figuring this out is monumentally appreciated.!!!!!!!!!!!!!!!

    Sincerely,

    KK