开发者

log4j not logging when using JBOSS_HOME

开发者 https://www.devze.com 2023-03-24 22:42 出处:网络
I am trying to configure the loggin to my web application. This is where I want my application to put the logs:

I am trying to configure the loggin to my web application.

This is where I want my application to put the logs:

C:\installs\JBossServer\jboss-6-0\server\default\log\kiche

If I do the following in the log4J.properties, the logs are created fine:

log4j.appender.R.File =C:\\installs\\JBossServer\\jboss-6-0\\server\\def开发者_JAVA百科ault\\log\\kiche\\kicheapp.log

I have an environment variable

JOBSS_HOME=C:\installs\JBossServer\jboss-6-0

And when I do like following in the log4J.properties, it not working.

log4j.appender.R.File=${JBOSS_HOME}\\server\\default\\log\\kiche\\kicheapp.log

Can someone please help me, I want to use JBOSS_HOME, so that its not hardcoded.

I am using JBOSS as a webserver.

Any help will be greatly appreciated.

Regards Adofo


Maybe better is to edit jboss-log4j.xml ?


You should try :

JBOSS_HOME=C:\\installs\\JBossServer\\jboss-6-0

and also :

JBOSS_HOME=C:/installs/JBossServer/jboss-6-0 (change log4j.appender.R.File accordingly with "/" instead of "\\")

Also, is there a typo in your question or in your variable ? (JBOSS_HOME vs JOBSS_HOME)


log4J.properties cannot access the environment variables directly. Instead , you should use java system properties to do the substitution.

Tomcat 's start up script has the option -D<name>[=<value>] to set a system property .Please try to start the tomcat by using run.sh -DJBOSS_HOME=C:\installs\JBossServer\jboss-6-0

0

精彩评论

暂无评论...
验证码 换一张
取 消