I figured it out. I just attached the log4j source code in Eclipse
and set a bunch of break points. The offending library appears to be
calling LogManager.getRootLogger().setLevel(Level.ERROR). My
work-a-round is simply to reset it back to what it used to be. Any
other suggestions? Yes, I'll talk to the third party about this poor
behavior.
My work-a-round:
Level originalLevel = rootLogger.getLevel();
openDocument(); // third party function call
Level modifiedLevel = rootLogger.getLevel();
System.out.println("original level: "+originalLevel);
System.out.println("modified level: "+modifiedLevel);
rootLogger.setLevel(originalLevel);
original level: DEBUG
modified level: ERROR
Cameron
On 6/9/06, Cameron Taggart <[EMAIL PROTECTED]> wrote:
Sorry if this is slightly off topic as I have boiled this down to more
of a log4j issue. I'm using SLF4J in my project, but a third party
library uses log4j directly. When I call one of their methods all
logging statements bellow ERROR Level seem to disappear. I've tried
passing in -Dlog4j.debug=true -Dlog4j.disableOverride=true to the
application and it doesn't seem to help. I tried using log4j 1.2.8
and the 1.2.13. log4j.debug doesn't mention anything about being
overridden.
Here is sample code and output.
package test;
import org.apache.log4j.Logger;
import com.crystaldecisions.reports.sdk.ReportClientDocument;
/** What are the CR4E libraries doing with log4j? */
public class DisappearingLog4j {
private final static Logger log =
Logger.getLogger(DisappearingLog4j.class);
private final static String file = "CrystalReport1.rpt";
public static void main(String[] args) throws Exception {
ReportClientDocument clientDoc = new ReportClientDocument();
log.debug("This debug statement shows up.");
log.info("This info statement shows up.");
log.warn("This warn statement shows up.");
log.error("This error statement shows up.");
clientDoc.open(file, 0);
log.debug("This debug statement does not show up!!!");
log.info("This info statement does not show up!!!");
log.warn("This warn statement does not show up!!!");
log.error("This error statement shows up.");
}
}
2006-06-09 17:30:19,603 DEBUG test.DisappearingLog4j This debug
statement shows up.
2006-06-09 17:30:19,603 INFO test.DisappearingLog4j This info
statement shows up.
2006-06-09 17:30:19,603 WARN test.DisappearingLog4j This warn
statement shows up.
2006-06-09 17:30:19,603 ERROR test.DisappearingLog4j This error
statement shows up.
2006-06-09 17:30:21,065 ERROR test.DisappearingLog4j This error
statement shows up.
Any help is appreciated.
Cameron
_______________________________________________
user mailing list
[email protected]
http://slf4j.org/mailman/listinfo/user