• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Logging using log4j in JBoss

 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is my log4j.xml
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
<errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
<param name="Target" value="System.out"/>
<!-- I changed the value below from INFO to DEBUG -->
<param name="Threshold" value="DEBUG"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/>
</layout>
</appender>
The only change I made (as the comment suggests) is to change the level from INFO to DEBUG. Because of the change in the console I am getting all the debug messages which is great. I am also getting DEBUG level messages for struts 1.1 which is a lot of messages. Is there a way to have my code level to be DEBUG and all the struts code to have level INFO.
thanks.
- walk rustin
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First you set the root category.
<root>
<appender-ref ref="CONSOLE"/>
<!-- You can add all other appenders -->
</root>
Limit the categories using
<category name="org.apache.struts">
<priority value="WARN"/>
</category>
Also for your application u can change the levels just by adding another category .
[ April 15, 2004: Message edited by: Vijayanandraj Amaladoss ]
 
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Walker,
Apparently there's a humongous problem with Log4j overwriting logging levels when separate configurations are loaded in deployed applications. You may need to use the specific deployment descriptors for the jboss equivalent of EAR to ensure that a separate classloader is used for your application. That way there won't be any conflict between your Log4j settings and JBoss's.
reply
    Bookmark Topic Watch Topic
  • New Topic