This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes JBoss/WildFly and the fly likes loggin setup in Jboss Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "loggin setup in Jboss" Watch "loggin setup in Jboss" New topic
Author

loggin setup in Jboss

Simpson Kumar
Ranch Hand

Joined: Mar 19, 2008
Posts: 261
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.


Thanks,
Kumar
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5823
    
    7

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:



JBoss In Action
Simpson Kumar
Ranch Hand

Joined: Mar 19, 2008
Posts: 261
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

Joined: Mar 19, 2008
Posts: 261
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

Joined: Mar 19, 2008
Posts: 261
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

Joined: May 14, 2008
Posts: 5823
    
    7

A book on Log4J, or the Log4J javadocs, should be able to show you how to control logging configuration programmatically.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: loggin setup in Jboss