Hi : I have used log4j for looging error log using FileAppender. The problem is its logging the same error two times in a log file when the below situation
Case1:
Class1 :
public void func(){
try{
new Class2.prop()
}catch(IOException ioe){
logger.log(2,ioe);
}
}
Class2 :
public void prop(){
try{
//error oocurs here
}catch(FileNotFoundException fe){
logger.log(2,fe);
}
}
Error :
Class2 .FileNotFoundException
at Class2.prop(Class2.java:3)
at Class1.func(Class1.java:4)
Log File :
FileNotFound exception
FileNotFound exception
But its logging the error one time for the below case.
Case2 :
Class1 :
public void func(){
try{
new Class2.prop()
//error oocurs here
}catch(IOException ioe){
logger.log(2,ioe);
}
}
Class2 :
public void prop(){
try{
}catch(FileNotFoundException fe){
logger.log(2,fe);
}
}
Error :
Class2 .IOException
at Class1.func(Class1.java:4)
Log File :
IOException exception
Help me what should i do to log the error only one time in a log file whereever it is.