5

Hi all I am new to Jboss so I am get confused while setting up an logging in Jboss 6.1 what I does I have download and extract the Jboss (jboss-eap-6.1) on my machine then I follow the steps given in this article but still I not able to see the logging on console or in file

the I google it around and come to know that I have to write jboss-deployment-structure.xml file under /META-INF/ folder and have to add -Dorg.jboss.as.logging.per-deployment=false to the start-up of the server (which I dont know where I have to set this) from this link

so can any one give me steps to configure logging in jboss 6.x with Log4j or any logging like java.util.logging to log statements on console or in file thanks.

4

2 回答 2

3

你应该在 Jboss 的 /bin 文件夹中找到standalone.bat 文件,然后你应该编辑这个文件,找到下一行

rem Setup JBoss specific properties
set JAVA_OPTS=-Dprogram.‌​name=%PROGNAME% %JAVA_OPTS%

并为此替换

set "JAVA_OPTS= -Dorg.jboss.as.logging.per-deployment=false"

于 2016-08-16T16:10:03.710 回答
0
  1. 如果你想记录

    一个。你想使用你自己的“log4j.jar”把它放在 lib 文件夹中

    湾。将 jboss-deployment-structure.xml 放在 META-INF 文件夹中

    C。在 WEB-INF/classes 中添加 log4j.xml

    您的应用程序。

  2. 在 jboss-deployment-structure.xml 中添加这个

    <?xml version="1.0" encoding="UTF-8"?>
    <jboss-deployment-structure>
      <deployment>
        <exclusions>
        <module name="org.apache.log4j" />
        </exclusions>
      </deployment>
    </jboss-deployment-structure>
    
  3. 在 log4j.xml 中添加这个

     <?xml version="1.0" encoding="UTF-8" ?>
       <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
         <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
           <appender name="appender" class="org.apache.log4j.FileAppender">
               <param name="File" value="${jboss.server.log.dir}/server.log"/>
               <param name="Append" value="true"/>
            <layout class="org.apache.log4j.PatternLayout">
               <param name="ConversionPattern" value="%d [%t] %p - %m%n"/>
            </layout>
           </appender>
         <root>
          <priority value ="trace"/>
        <appender-ref ref="appender"/>
         </root>
        </log4j:configuration>
    

    然后你可以在控制台上看到登录......

于 2013-09-24T12:33:54.633 回答