JBoss 3.2.1 (no trial for the new version)
I want to use logs in my own program, but it is in conflict with the log4j configuration of JBoss. I wrote logs in my program and did not record them.
It seems that JBoss's log4j configuration directly overwrites the log4j configuration of its own program. There are conflicting solutions on the Internet.
Http://hi.baidu.com/xixitie/blog/item/be1a728087c1c6d39023d907.html
It is a little troublesome, so I don't want to use the JBoss log4j configuration directly?
The procedure is as follows:
Find the log4j. xml file in the/JBoss/Server/default/conf directory.
1.
Add two appender
<Appender name = "log_console" class = "org. apache. log4j. consoleappender "> <br/> <Param name =" target "value =" system. out "/> <br/> <Param name =" threshold "value =" debug "/> <br/> <layout class =" org. apache. log4j. patternlayout "> <br/> <Param name =" conversionpattern "value =" % d {absolute} %-5 p [% c {1}] % m % N "/> <br/> </layout> <br/> </appender> </P> <p> <appender name = "LOG_FILE" class = "org. JBoss. logging. appender. rollingfileappender "> <br/> <Param name =" file "value =" $ {JBoss. server. home. dir}/log/logtest. log "/> <br/> <Param name =" APPEND "value =" false "/> <br/> <Param name =" maxfilesize "value =" 3000kb "/> <br/> <Param name = "maxbackupindex" value = "1"/> <br/> <layout class = "org. apache. log4j. patternlayout "> <br/> <Param name =" conversionpattern "value =" % d %-5 p [% c {1}] % m % N: "/> <br/> </layout> <br/> </appender> <br/>
2. Added category.
<Category name = "UF. bbt. logtest "> <br/> <priority value =" debug "/> <br/> <appender-ref =" log_console "/> <br/> <appender-ref = "LOG_FILE"/> <br/> </Category> <br/>
Priority can also be changed to level. There is no difference during the test.
In addition, I used the console instead of log_console, and the result was not displayed. I configured the log_console myself for the effect.
If you change this configuration
<Logger name = "UF. bbt. logtest "additivity =" false "> <br/> <level value =" debug "/> <br/> <appender-ref =" log_console "/> <br/> <appender-ref = "LOG_FILE"/> <br/> </logger> <br/>
The results are the same. Why didn't I check the log4j manual?
OK, click it ^