This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread 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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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: 260
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: 5772
    
    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: 260
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: 260
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: 260
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: 5772
    
    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
 
Similar Threads
Logging in JBOSS
Jboss 4.2.3 JVM Monitoring
how to load logger properties dynamically
JBOSS5.0 EJB3 lookup issue
Struts 2 problem -- There is no Action mapped for namespace / and action name