Thanks for your answer and your time. Why the root logger defined: <root> <level value="debug"/> <appender-ref ref="taskRedirection"/> <appender-ref ref="addQuestionSequenceOrder"/> </root> knows that all the logs from ALL the classes should go the the file specified by appenders:taskRedirection, addQuestionSequenceOrder and a logger:
<logger name="curam.tools.upgradehelper.ieg.QuestionSequenceOrderConverter" additivity="true"> <level value="debug"/> <appender-ref ref="addQuestionSequenceOrder"/> </logger> knows that ONLY logs from that class curam.tools.upgradehelper.ieg.QuestionSequenceOrderConverter has to be "served"? Is no't realy any way to duplcate the work of the root logger in logger specified by the name curam.tools.upgradehelper.ieg.QuestionSequenceOrderConverter? If not, why this parameter additivity="true" is present at all? It does nothing. MR. Thorbjørn Ravn Andersen wrote: > > Camer38 skrev den 03-07-2008 15:25: >> My assumption was that if I run one of the class >> curam.tools.upgradehelper.ieg.QuestionSequenceOrderConverter I would got >> all >> the logs from that class and all the classes used internally by >> curam.tools.upgradehelper.ieg.QuestionSequenceOrderConverter in the >> addQuestionSequenceOrderTool.log. >> > No. The logger frameworks do not do magic to deduce where logging > should go. If you want for classes called to use a specific logger, you > must pass it as an argument like all values you want to use. > > >> Instead I got an log4j warning: >> >> log4j:WARN No appenders could be found for logger >> (curam.tools.upgradehelper.util.SQLStatements). >> >> > You are most likely using a logger variable in SQLStatements which has > been defined at the top of that class referring to SQLStatments.class. > > This does not allow log4j to distinguish between the two cases you have. > > I have the same problem in a project where it is two threads logging in > the same file. I have not yet found a good solution. >> During my testing I have defined a root logger as well, but it does not >> do >> what I want. >> >> All the expected lines are present in both files but the files are >> populated >> with the log from the same class. >> <root> >> <level value="info"/> >> <appender-ref ref="taskRedirection"/> >> <appender-ref ref="addQuestionSequenceOrder"/> >> </root> >> >> > > This say that you want all messages at info level or higher to go to > both the taskRedirection appender AND the addQuestionSequenceOrder > appender. > > -- > Thorbjørn > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/%22additivity%22-attribute-does-not-work-for-user-defined-logger-but-works-for-root-logger.-tp18259092p18263109.html Sent from the Log4j - Users mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]