logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Camer38 <rembi...@gmail.com>
Subject RE: "additivity" attribute does not work for user-defined logger but works for root logger.
Date Thu, 03 Jul 2008 15:45:05 GMT

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<!-- 
log4j.xml holds information about logging parameters for 5.0 tools.
The loogers and appenders are created fro GUI tools and stand alone tools
tools from .\bin folder
-->
<log4j:configuration debug="true"
xmlns:log4j="http://jakarta.apache.org/log4j/">
    
    <appender name="addQuestionSequenceOrder"
class="org.apache.log4j.RollingFileAppender">
        
        
        
        
        <layout class="org.apache.log4j.PatternLayout">
            
        </layout>
    </appender>

    <appender name="taskRedirection"
class="org.apache.log4j.RollingFileAppender">
        
        
        
        
        <layout class="org.apache.log4j.PatternLayout">
            
        </layout>
    </appender>

    <logger
name="curam.tools.upgradehelper.ieg.QuestionSequenceOrderConverter"
additivity="true">
        <level value="debug"/>
        <appender-ref ref="addQuestionSequenceOrder"/>
    </logger>

    <logger
name="curam.tools.upgradehelper.taskredirection.TaskRedirectionConverter">
        <level value="info"/>
        <appender-ref ref="taskRedirection"/>
    </logger>
    
</log4j:configuration>


I use log4j-1.2.15.jar 

I run the tool with -Dlog4j.debug=true option , and I have the following
information:

Buildfile: addQuestionSequenceOrder.xml

addQuestionSequenceOrderConverter:
     [java] log4j: Trying to find [log4j.xml] using context classloader
sun.misc.Launcher$AppClassLoader@754a754a.
     [java] log4j: Using URL
[file:/C:/CURAM/CuramUpgradeHelper/bin/log4j.xml] for automatic log4j
configuration.
     [java] log4j: Preferred configurator class:
org.apache.log4j.xml.DOMConfigurator
     [java] log4j: System property is :null
     [java] log4j: Standard DocumentBuilderFactory search succeded.
     [java] log4j: DocumentBuilderFactory is:
org.apache.xerces.jaxp.DocumentBuilderFactoryImpl
     [java] log4j: debug attribute= "true".
     [java] log4j: reset attribute= "false".
     [java] log4j: Threshold ="null".
     [java] log4j: Retreiving an instance of org.apache.log4j.Logger.
     [java] log4j: Setting
[curam.tools.upgradehelper.ieg.QuestionSequenceOrderConverter] additivity to
[true].
     [java] log4j: Level value for
curam.tools.upgradehelper.ieg.QuestionSequenceOrderConverter is  [debug].
     [java] log4j:
curam.tools.upgradehelper.ieg.QuestionSequenceOrderConverter level set to
DEBUG
     [java] log4j: Class name: [org.apache.log4j.RollingFileAppender]
     [java] log4j: Setting property [file] to
[./logs/addQuestionSequenceOrderTool.log].
     [java] log4j: Setting property [threshold] to [DEBUG].
     [java] log4j: Setting property [maxFileSize] to [2000KB].
     [java] log4j: Setting property [maxBackupIndex] to [10].
     [java] log4j: Parsing layout of class: "org.apache.log4j.PatternLayout"
     [java] log4j: Setting property [conversionPattern] to
[%d{yyyy-MM-dd-ss} [%t] %5p %c.%M(%F:%L) - %m%n].
     [java] log4j: setFile called: ./logs/addQuestionSequenceOrderTool.log,
true
     [java] log4j: setFile ended
     [java] log4j: Adding appender named [addQuestionSequenceOrder] to
category [curam.tools.upgradehelper.ieg.QuestionSequenceOrderConverter].
     [java] log4j: Retreiving an instance of org.apache.log4j.Logger.
     [java] log4j: Setting
[curam.tools.upgradehelper.taskredirection.TaskRedirectionConverter]
additivity to [true].
     [java] log4j: Level value for
curam.tools.upgradehelper.taskredirection.TaskRedirectionConverter is 
[info].
     [java] log4j:
curam.tools.upgradehelper.taskredirection.TaskRedirectionConverter level set
to INFO
     [java] log4j: Class name: [org.apache.log4j.RollingFileAppender]
     [java] log4j: Setting property [file] to
[./logs/taskRedirectionTool.log].
     [java] log4j: Setting property [threshold] to [INFO].
     [java] log4j: Setting property [maxFileSize] to [2000KB].
     [java] log4j: Setting property [maxBackupIndex] to [10].
     [java] log4j: Parsing layout of class: "org.apache.log4j.PatternLayout"
     [java] log4j: Setting property [conversionPattern] to
[%d{yyyy-MM-dd-ss} [%t] %5p %c.%M(%F:%L) - %m%n].
     [java] log4j: setFile called: ./logs/taskRedirectionTool.log, true
     [java] log4j: setFile ended
     [java] log4j: Adding appender named [taskRedirection] to category
[curam.tools.upgradehelper.taskredirection.TaskRedirectionConverter].
     [java] Using configured properties for logging.
     [java] Using configured properties for logging.
     [java] log4j:WARN No appenders could be found for logger
(curam.tools.upgradehelper.util.SQLStatements).
     [java] log4j:WARN Please initialize the log4j system properly.
     [java] Connecting to Oracle data source :
oracle.jdbc.pool.OracleDataSource.

BUILD SUCCESSFUL
Total time: 3 seconds

 Could you help me with defining a correct log4j.xml file?


Bender Heri wrote:
> 
> Please provide your full log4j.xml.
> Heri 
> 
>> -----Original Message-----
>> From: Camer38 [mailto:rembiszm@gmail.com] 
>> Sent: Thursday, July 03, 2008 3:26 PM
>> To: log4j-user@logging.apache.org
>> Subject: "additivity" attribute does not work for 
>> user-defined logger but works for root logger.
>> 
>> 
>> I have two Java classes that used log4j. 
>> 
>> curam.tools.upgradehelper.ieg.QuestionSequenceOrderConverter 
>> and 
>> curam.tools.upgradehelper.taskredirection.TaskRedirectionConverter 
>> 
>> Both classes from above uses different class: 
>> curam.tools.upgradehelper.util.SQLStatements 
>>  
>> where a logger in each of the class with defined in following 
>> pattern: 
>> private static final Logger log = 
>> Logger.getLogger(NameOfTheClass.class); 
>> 
>> Next I have defined log4j.xml. I want to have a full log file 
>> in two separate files for both classes. 
>> 
>> curam.tools.upgradehelper.ieg.QuestionSequenceOrderConverter 
>> in QuestionSequenceOrderConverterTool.log
>> curam.tools.upgradehelper.taskredirection.TaskRedirectionConve
>> rter in TaskRedirectionConverterTool.log 
>> 
>> I did a following:                         
>>  I have not defined root at all. 
>> 
>> 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.
>> 
>> 
>>  Instead I got an log4j warning: 
>> 
>> log4j:WARN No appenders could be found for logger 
>> (curam.tools.upgradehelper.util.SQLStatements). 
>> 
>> 
>> What is the meaning of the attribute "additivity" for each logger? 
>> Why don't I get all the logs in one file? 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>>  
>> 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>
>> 
>> 
>> I use log4j-1.2.15.jar
>> 
>>  Could anybody help me with defining a correct log4j.xml file?
>> --
>> View this message in context: 
>> http://www.nabble.com/%22additivity%22-attribute-does-not-work
>> -for-user-defined-logger-but-works-for-root-logger.-tp18259092
>> p18259092.html
>> Sent from the Log4j - Users mailing list archive at Nabble.com.
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>> 
>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/%22additivity%22-attribute-does-not-work-for-user-defined-logger-but-works-for-root-logger.-tp18259092p18261272.html
Sent from the Log4j - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Mime
View raw message