Bug 48027 - Logger statements in a particular class file is not printed always
Summary: Logger statements in a particular class file is not printed always
Status: NEEDINFO
Alias: None
Product: Log4j - Now in Jira
Classification: Unclassified
Component: Other (show other bugs)
Version: 1.2
Hardware: Sun Solaris
: P2 critical
Target Milestone: ---
Assignee: log4j-dev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-10-20 03:52 UTC by Anoop
Modified: 2009-11-08 13:24 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Anoop 2009-10-20 03:52:59 UTC
Hello,

My application has run into an issue where some log statements in "one particular class" do not get printed at times. The issue is not  reproduced in a consistent manner ie. it may happen on some days/may not on some other days.

Here is the structure of the two classes which has reported the issue. I have a class A and another class B which has extended the class A. I am printing 2 log statements in class B(one statement using the logger object of class A (logA object), and the other statement with the logger object of class B (logB object)). But the logger statement using the logA object does not get printed on some days. After a server restart, it starts working fine. Is there some thread which gets killed?

public class A{
   protected static Logger logA = Logger.getLogger(A.class);
   
   public static void myLog(String s) {
		logA.info("in myLog, " + s);
   }

}

public class B extends A{

protected static Logger logB = Logger.getLogger(B.class);
.
.
.
.
myLog("Log Statement Number 1"); //This statement does not get printed all the time
logB.info("Log Statment Number 2"); //This statement always get printed

}
This is not just a problem with the non-functioning log statements, but the entire code in this particular class seems to be working wrong due to this issue. This is hampering the functionality of my application. Any help is appreciated. 

Thanks
Anoop
Comment 1 Curt Arnold 2009-11-08 13:22:35 UTC
Not really enough info to try to determine if there is a problem.  You are logging to two different loggers and there is no information on how the app is configured, what appenders are attached, any dynamic reconfiguration, etc.  Any number of valid reasons could be responsible for your observation as well as any number of potential bugs.

Running with log4j.debug=true may give you some diagnostics that may help you.
Comment 2 Curt Arnold 2009-11-08 13:24:50 UTC
Also, this appears to be more of a usage question that a bug report.  If you can not identify or isolate the problem, please post on log4j-user to get assistance.  If you get a resolution, come back and update or resolve this bug report.