Define jboss logs in the application level.

Hi,
The next post will demonstrate how to define jboss logs for a specific application
in a way that it will write all it’s logs to an independent log file.

(tested on Jboss5.1 AS)

Under jboss-dir/conf we have file named: jboss-log4j.xml

1. let’s add new appender:

  
     
     
     
     
     

     
       
     
   

2. let’s add category:

   
     < priority value="debug" />
     < appender-ref ref="projectName" />
   

Now on each class we want to use the Logger(which is imported from org.apache.log4j.Logger) we need to use it this way:

public class Someclass

      private final static Logger logger = Logger.getLogger(Someclass.class);
      public dispatchMsg()
      {
         logger.debug("My first log msg");
      }
}

Idan.

[ad]

Related Articles:

(963)

Be Sociable, Share!

Leave a Reply