<body><script type="text/javascript"> function setAttributeOnload(object, attribute, val) { if(window.addEventListener) { window.addEventListener('load', function(){ object[attribute] = val; }, false); } else { window.attachEvent('onload', function(){ object[attribute] = val; }); } } </script> <div id="navbar-iframe-container"></div> <script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script> <script type="text/javascript"> gapi.load("gapi.iframes:gapi.iframes.style.bubble", function() { if (gapi.iframes && gapi.iframes.getContext) { gapi.iframes.getContext().openChild({ url: 'https://www.blogger.com/navbar.g?targetBlogID\x3d13807087\x26blogName\x3djaxrpc\x26publishMode\x3dPUBLISH_MODE_BLOGSPOT\x26navbarType\x3dBLUE\x26layoutType\x3dCLASSIC\x26searchRoot\x3dhttp://jaxrpc.blogspot.com/search\x26blogLocale\x3den_US\x26v\x3d2\x26homepageUrl\x3dhttp://jaxrpc.blogspot.com/\x26vt\x3d846299474934543371', where: document.getElementById("navbar-iframe-container"), id: "navbar-iframe" }); } }); </script>
Google  
Web    Images    GroupsNew!    News    Froogle    more »
  Advanced Search
  Preferences    
 Web Results 1 - 10 for jaxrpc[definition].  
 
    
« Home

Posts

Here are some basic fundamentals and when to use t...
J2EE Spefication versions
Sometime the basics such as heap, stack causes man...
Practical UML
Some open source API's
Oracle JDBC Connection pool in Sun Java System App...
Sun Java System App server vs Tomcat
Using JavaServer Faces Technology with AJAX
Stored Procedure in Hibernate
Very interesting application to record DRM protect...
 
     Archives
June 2005
July 2005
August 2005
September 2005
October 2005
November 2005
December 2005
February 2006
March 2006
April 2006
June 2006
August 2006
December 2006
August 2007
May 2008
February 2009
March 2010
August 2010
 
     Links
Java Podcast

Log4J Example


In many of my projects I implemented log4j as rootLogger instead of categorizing
them based on packages or by business modules
After reading through log4j manual many times, still Ididn't understand how to implement the logger categories and levels. Here is a working sample and troubleshooting in case you run into issues as I did.


## Sample log4j configuration specified in log4.properties
log4j.rootLogger=FATAL, stdout
log4j.logger.com.mycomp.local=WARN, stdout log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
# Pattern to output the caller's file name and line number.
log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) - %m%n

#Sample code using this logger category
package com.mycomp.local;

import org.apache.log4j.Logger;
public class Sample1
{
private static Logger myLog = Logger.getLogger(Sample1.class);
public Sample1(){}
public static void main(String[] args) {
Enumeration enumList = LogManager.getCurrentLoggers();
while(enumList.hasMoreElements()){
Logger myLog = (Logger)enumList.nextElement();
myLog.getName();
System.out.println("Current Logger -" +myLog.getName() + "="+
myLog.getLevel());
}
myLog.debug("Inside debug1");
myLog.warn("Inside Warn1");

}

The important thing to note about the configuration is to specify appender.
Without the stdout appender in

log4j.logger.com.mycomp.local=WARN, stdout


The program would print DEBUG information even though root category is set to FATAL Give it a try!

- Sunday, March 19, 2006 -

Post a Comment


Result Page: 

 



















 


 

Search within results | Language Tools | Search Tips | Dissatisfied? Help us improve


Google Home - Blogger - Blogger Templates

© 2005 jaxrpc