Wednesday, June 22, 2011

How to set jboss.server.log.dir in JBoss


Target audience: Beginners
Version: JBoss 4.2.x

By Default, JBoss writes the server log files to /jboss-4.2.0.GA/server/default/log location. We can change this location by specifying a system parameter jboss.server.log.dir .

For Example, if you want JBoss to write the server log file to “C:/Logs/JBoss/myapp”, then what you should do is to set a system property as this -Djboss.server.log.dir=C:/Logs/JBoss/myapp

As this property is used during bootstrap, this should be set when JVM starts. To do this, open “run.bat” file and set bellow entry. Remember to keep a space in front of %JAVA_OPTS%

set JAVA_OPTS=-Djboss.server.log.dir=C:/Logs/JBoss/myapp %JAVA_OPTS%
After setting this, start the JBoss server. you would see the log files would be created under “C:/Logs/JBoss/myapp

In the same way, you can set some other JBoss properties too. Some are given bellow

jboss.home.dir - The base directory of the jboss distribution - default: $JBOSS_HOME
jboss.home.url - The base url of the jboss distribution - default $JBOSS_HOME
jboss.lib.url - The url where the kernel jars exist - default: $jboss.home.url/lib
jboss.patch.url - A directory where patch jars exist - default: none
jboss.server.name - The configuration name of the server - default: default
jboss.server.base.dir - The directory where server configurations exist - default: $jboss.home.dir/server
jboss.server.base.url - The url where server configurations exist - default: $jboss.home.url/server
jboss.server.home.dir - The directory for the current configuration - default: $jboss.server.base.dir/$jboss.server.name
jboss.server.home.url - The url for the current configuration - default: $jboss.server.base.url/$jboss.server.name
jboss.server.temp.dir - The directory for temporary files - default: $jboss.server.home.dir/tmp
jboss.server.data.dir - The directory for data files - default: $jboss.server.home.dir/data
jboss.server.config.url - The url for configuration files - default: $jboss.server.home.url/conf
jboss.server.lib.url - The url for static jar files - default: $jboss.server.home.url/lib
jboss.server.log.dir - The directory where the server logs are written - default: $jboss.server.home.dir/log

Hope this is helpful for you.