What is the Dictionary class

The Dictionary class provides the capability to store key-value pairs.

Showing Answers 1 - 1 of 1 Answers

RIT

  • Jul 25th, 2005
 

run this file, i think result will itself explain you the use of LOG4J. otherwise mail me ritesh.patni@gmail.com :- 
package com.banking.log4j; 
import org.apache.log4j.*; 
 
import com.lnt.banking.constant.ConstantIf; 
public class TestLogging { 
static Logger cat = Logger.getLogger(ConstantIf.LOG4JKEY); 
static Logger cat1 = Logger.getLogger("com.foo"); 
//static Logger cat1 = (Logger) Logger.getInstance(TestLogging.class.getName()); 
static 

BasicConfigurator.configure(); 
try { 
cat.setLevel(Level.ERROR); 
cat1.setLevel(Level.DEBUG); 
cat1.addAppender(new RollingFileAppender(new HTMLLayout(),ConstantIf.dest1)); 
} catch (Exception e) { 
cat.fatal("The Exception is : ",e); 

finally 

cat1.fatal("The Exception is : "); 
cat.fatal("The Exception is : "); 


public static void main(String[] args) { 
System.out.println(args.length); 
cat1.debug("Start of the MAIN()-- CAT1"); 
cat1.info("This is Testing for the INFO method()-- CAT1"); 
cat1.warn("This is Testing for the WARN method()-- CAT1"); 
cat1.error("This is Testing for the ERROR method()-- CAT1"); 
cat1.fatal("This is Testing for the fatal method()-- CAT1"); 
cat.debug("Start of the MAIN()"); 
cat.info("This is Testing for the INFO method()"); 
cat.warn("This is Testing for the WARN method()"); 
cat.error("This is Testing for the ERROR method()"); 
cat.fatal("This is Testing for the fatal method()"); 
new TestLogging().init(); 

public void init(){ 
java.util.Properties prop = System.getProperties(); 
java.util.Enumeration enum = prop.propertyNames(); 
 
cat.info("*******System Enviroment As seen by Java ****"); 
cat.debug("******Format : PROPERTY + VALUE *****"); 
try 

throw new Exception("exception "); 

catch(Exception e) 

cat.error("This is new Error",e); 

finally 

cat1.info("You Are at the end of the INIT() of the TestLogging class"); 
cat.info("You Are at the end of the INIT() of the TestLogging class"); 

 


  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions