How do you specify an external log4j properties file to start a jboss server?

早过忘川 提交于 2020-02-05 08:57:10

问题


How do you specify an external log4j properties file to run a jboss server with?

I need to do this with bash/ terminal commands? Not programmatically


回答1:


Create a folder to store log4j.properties (i.e C:\PropertiesFolder).
Then add the link to this folder to JBoss classpath:

  1. Go to [server folder]\bin
  2. Edit run.bat (if server is running on Windows) or run.sh (for Linux)
  3. Edit classpath line by adding the folder link:

Snippet:

if "x%JBOSS_CLASSPATH%" == "x" (
  set "RUN_CLASSPATH=%RUNJAR%;C:\PropertiesFolder;"
) else (
  set "RUN_CLASSPATH=%JBOSS_CLASSPATH%;%RUNJAR%;C:\PropertiesFolder;"
)

Finally restart the server then run by command line (go to [server folder]\bin then type run)




回答2:


You can put the log4j.properties file in the classpath.




回答3:


If the target version of Jboss is 7.1.x - then you need to follow the simple 2 steps, that are described in the official documentation.

How do I use log4j.properties or log4j.xml instead of using the logging subsystem configuration?

https://docs.jboss.org/author/display/AS71/How+To#HowTo-HowdoIuselog4j.propertiesorlog4j.xmlinsteadofusingtheloggingsubsystemconfiguration%3F

Hope that helps



来源:https://stackoverflow.com/questions/11040936/how-do-you-specify-an-external-log4j-properties-file-to-start-a-jboss-server

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!