Log4j configuration of applications in JBoss

Source: Internet
Author: User

 

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 ^

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.