problem with log4j.properties and level DEBUG

Hi,

I need some log4j help.

I create 2 different appenders in the log4j.properties file

and it works.

This is my complete log4j.properties:

log4j.logger.log1=DEBUG, log1

log4j.logger.log2=DEBUG, log2

log4j.appender.log1=org.apache.log4j.DailyRollingFileAppender

log4j.appender.log1.File=${StandardLogPath}

log4j.appender.log1.DatePattern='.'yyyy-MM-dd

log4j.appender.log1.Append=true

#log4j.appender.log1.Threshold=DEBUG

log4j.appender.log1.layout=org.apache.log4j.PatternLayout

log4j.appender.log1.layout.ConversionPattern=%d{dd MMM yyyy HH:mm:ss} [%-5p] %-25c{1} %m%n

log4j.appender.log2=org.apache.log4j.DailyRollingFileAppender

log4j.appender.log2.File=${StandardLogQueryPath}

log4j.appender.log2.DatePattern='.'yyyy-MM-dd

log4j.appender.log2.Append=true

log4j.appender.log2.layout=org.apache.log4j.PatternLayout

log4j.appender.log2.layout.ConversionPattern=%d{dd MMM yyyy HH:mm:ss} [%-5p] %-25c{1} %m%n

And here's my logging code:

import org.apache.log4j.Logger;

Logger log = Logger.getLogger("log1");

Logger logQuery = Logger.getLogger("log2");

log.debug("loggerDebug");

logQuery.debug("loggerDebug");

log.info("loggerInfo");

logQuery.info("loggerInfo");

The problem is that "loggerDebug" is not written to all appenders (only "loggerInfo").

In fact if I print:

System.out.println( log.getEffectiveLevel().toString() );

result that the level is INFO and I known that if level is INFO then DEBUG is disable.

But why the level is INFO?

Someone can suggest me a solution?

Thank you very much

[2291 byte] By [cricclaa] at [2007-10-2 22:33:29]
# 1
I would have to believe that you are actually running with some other log4j configuration, not the one you posted here.
warnerjaa at 2007-7-14 1:50:53 > top of Java-index,Java Essentials,Java Programming...
# 2
I know that it seems impossible but I'm running with the configuration I've posted, I'm sure!I've also thought about a problem of version (I'm using log4j 1.2.8) but it seems strange.. I don't know just what to think.Do you have any idea?
cricclaa at 2007-7-14 1:50:53 > top of Java-index,Java Essentials,Java Programming...
# 3

> I know that it seems impossible but I'm running with

> the configuration I've posted, I'm sure!

> I've also thought about a problem of version (I'm

> using log4j 1.2.8) but it seems strange..

> I don't know just what to think.

> Do you have any idea?

If you haven't already...

To be doubly sure, change that file so that the appenders write to some OTHER file names instead of what they are currently writing to. Rerun your test, and ensure they actually write to the other files.

warnerjaa at 2007-7-14 1:50:53 > top of Java-index,Java Essentials,Java Programming...
# 4
Or you could just be a flake and never reply back as to the progress or lack thereof of the issue.
warnerjaa at 2007-7-14 1:50:53 > top of Java-index,Java Essentials,Java Programming...
# 5

> Or you could just be a flake and never reply back as

> to the progress or lack thereof of the issue.

You're so over-sensitive you: when an OP doesn't respond anymore to

your last reply it implies that you've solved the problem and (implicitly)

that the OP is very grateful to you. Why do you always have to be so

explicit about matters? ;-)

kind regards,

Jos

ps. There are nice exception to the rule sometimes though.

JosAHa at 2007-7-14 1:50:53 > top of Java-index,Java Essentials,Java Programming...
# 6

> You're so over-sensitive you: when an OP doesn't

> respond anymore to

> your last reply it implies that you've solved the

> problem and (implicitly)

> that the OP is very grateful to you. Why do you

> always have to be so

> explicit about matters? ;-)

Because I'm not one of those Dutch people ;-)

>

> kind regards,

>

> Jos

>

> ps. There are nice exception to the rule sometimes

> though.

Yes, and unfortunately they do seem to be the exception rather than the rule. It would be nice to catch one a bit more often.

warnerjaa at 2007-7-14 1:50:53 > top of Java-index,Java Essentials,Java Programming...
# 7

> > You're so over-sensitive you: when an OP doesn't respond anymore

> > to your last reply it implies that you've solved the problem and

> > (implicitly) that the OP is very grateful to you. Why do you always

> > have to be so explicit about matters? ;-)

> Because I'm not one of those Dutch people ;-)

Yes, that's us, the Dutch: mysteriously smiling and keeping silent all the

time. That's why they call us the Asians of Western Europe ;-)

> > ps. There are nice exception to the rule sometimes though.

> Yes, and unfortunately they do seem to be the exception rather than

> the rule. It would be nice to catch one a bit more often.

True; that's the internet generation: grab all the information that you can

and don't give a f*ck about the guy who supplied the information. It's sad

indeed.

Maybe we should start a support group where we could thank each

other now and then 'on behalf' of those little spoiled brats and complain

about all those bad manners nowadays ;-)

kind regards,

Jos

JosAHa at 2007-7-14 1:50:53 > top of Java-index,Java Essentials,Java Programming...