2

I have two JVMs (server1 and server2) running on one Linux Machine. & I want to move logs from default directory to a custom directory for each JVM.

Something like -

/data/logs/$JVM_NAME/

so that final logs get to directories soemthing like

/data/logs/server1/
&
/data/logs/server2/

I learned that jboss.server.log.dir variable can be set in server startup arguments. Then I tried following startup command.

nohup sh /appl/isaac/jboss/jboss-eap-6.4/bin/domain.sh -b some.server.domain.com -bmanagement some.server.domain.com -Djboss.domain.log.dir=/data/logs -Djboss.server.log.dir=/data/logs/ > /tmp/domain.out 2>&1 &

This is working fine. And the logs are getting written in /data/logs/.

But I am not sure how to add a variable in these arguments to add one more sub directory with JVM name for each JVM on this machine. So that logs gets written to /data/logs/$JVM_NAME/.

Ashish Verma
  • 141
  • 5

1 Answers1

1

The value of the log.dir properties has to be the full path to where you want the logs.

For starting from the command line you could do:

export JVM_NAME="server1"; nohup sh /appl/isaac/jboss/jboss-eap-6.4/bin/domain.sh -b some.server.domain.com -bmanagement some.server.domain.com -Djboss.domain.log.dir=/data/logs/$JVM_NAME -Djboss.server.log.dir=/data/logs/$JVM_NAME > /tmp/domain.out 2>&1 &

However for having several servers started automatically use a variable for each server, this would usually be done in EAP_HOME/bin/standalone.conf or EAP_HOME/bin/domain.conf for each instance.

JVM_NAME="server1"
JAVA_OPTS="$JAVA_OPTS -Djboss.domain.log.dir=/data/logs/$JVM_NAME -Djboss.server.log.dir=/data/logs/$JVM_NAME" 

I am assuming here you have separate configurations set for the two servers you have running.

Not sure if you actually need to set both domain.log.dir and server.log.dir, I assume domain.log.dir is used when running in domain mode.

Stian Lund
  • 180
  • 5
  • I am not using EAP_HOME/bin/domain.conf for each instance. Not sure how to do that. – Ashish Verma Sep 05 '16 at 15:30
  • Have a look at the documentation here: https://access.redhat.com/solutions/350683 Generally one would copy the standalone/domain folder, then copy standalone/domain.conf into this folder and set the value of JBOSS_CONF to point to your specific config file. You also set the value of -Djboss.server.base.dir to the copied configuration directory. This allows you to tune Java properties for each server, like max.heap and so on. – Stian Lund Sep 05 '16 at 15:47