Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

loggin setup in Jboss

 
Simpson Kumar
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
we are using Jboss 4.2 and we need to implement apache commons logging in to our project. I can logging the statements in server.log but we need to log application level logs to different file. where we need to do in Jboss AS.
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JBoss AS uses the file server/xxx/conf/jboss-log4j.xml to configure logging. Add an appender in that file for the log file you want, and add one or more category entries for things you want to log there. Here's a partial example from JBoss in Action:

 
Simpson Kumar
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi peter thanks for replying,

I found that and changed to different log name. But here when I start the server, the logs statements are writing to log file and int increasing. I dont want server logs I want only application logs. How to avoid those?
 
Simpson Kumar
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, I got to avoid unnecessary loggings, I just added the following loggers to jboss-log4j.xml. i.e. simply avoided the jar files logs

 
Simpson Kumar
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here we got a change that they dont want to change the jboss-log4j.xml to configure new log file, they asked me load the same properties through java code and use them.
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A book on Log4J, or the Log4J javadocs, should be able to show you how to control logging configuration programmatically.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic