I've considered inheritance and have played with the additivity settings to
no avail.

It appears the problem is that the appenders can't be assigned priorities,
only categories can be assigned a single priority for all appenders,
through the xml configuration file or any type of config file.  Is this
always the case through all methods of setting up log4j?  Can each category
only have one priority?

Thanks,
Scott



                                                                                       
                                                    
                    "David Schultz"                                                    
                                                    
                    <dschultz@atstransport        To:     "'LOG4J Users Mailing List'" 
<[EMAIL PROTECTED]>                     
                    ation.com>                    cc:                                  
                                                    
                                                  Subject:     RE: Log4J Setup using 
XML Configuration File                                
                    10/04/2001 01:13 PM                                                
                                                    
                    Please respond to                                                  
                                                    
                    "LOG4J Users Mailing                                               
                                                    
                    List"                                                              
                                                    
                                                                                       
                                                    
                                                                                       
                                                    




While it is true that a Category can have multiple appenders, neither the
properties file definition nor the log4j.dtd have syntax for assigning a
Priority to an Appender.  Priority is assigned to the Category.

Also, don't forget the inheritance of Categories.  The Category
"com.lycos.subscriber.lSubscriber" inherits the behavior of "com.lycos" and
of "root"  (unless you set "additivity" for the Category to "false").

Hope this info helps...

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]
Sent: Thursday, 04.October 2001 12:42
To: [EMAIL PROTECTED]
Subject: Log4J Setup using XML Configuration File


First, a quick question: Its my assumption that each log4j category can
have muliple appenders.  Each appender for a category can also have its own
priority.  In theory, this means I can log all debug messages for a
category to one file, all error messages to another file, and warning
messages to stdout, if I desire.

If the answer to the above is yes, does the xml configuration class for
log4j allow for this?  I haven't been able to setup an XML file to attach
multiple appenders, each with different priorites to categories.  The last
appender's priority in the xml file seems to cancel out previous appenders'
priorities.

Here's my xml file below.  The last appender to a subcategory, causes all
logging messages to appear in my error log, which, in theory it shouldn't.
If multiple categories are included, it looks like the xml configuration
tool ignore the previous entry as well.

Thanks,
Scott

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">

<log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'
disableOverride="false" debug="true">
     <appender name="STDOUT" class="org.apache.log4j.ConsoleAppender">
             <layout class="org.apache.log4j.PatternLayout">
             <param name="ConversionPattern"
              value="[%-5p] [%d{ISO8601}] [%-40.25c]     %m%n"/>
           </layout>
     </appender>

     <appender name="FILELOG" class="org.apache.log4j.FileAppender">
            <param name="File"   value="..\\logs\\subscriber.log" />
            <param name="Append" value="true" />
            <layout class="org.apache.log4j.PatternLayout">
                    <param name="ConversionPattern" value="[%-5p]
[%d{ISO8601}] [%-40.25c]     %m%n"/>
            </layout>
     </appender>

     <appender name="ERRORLOG" class="org.apache.log4j.FileAppender">
            <param name="File"   value="..\\logs\\subscribererror.log" />
            <param name="Append" value="true" />
            <layout class="org.apache.log4j.PatternLayout">
                    <param name="ConversionPattern" value="[%-5p]
[%d{ISO8601}] [%-40.25c]     %m%n"/>
            </layout>
     </appender>

     <category name="root">
          <priority value="info" />
          <appender-ref ref="STDOUT" />
          <appender-ref ref="FILELOG" />
     </category>

     <category name="com.lycos">
          <priority value="error" />
          <appender-ref ref="ERRORLOG" />
     </category>

     <category name="com.lycos.subscriber.lSubscriber">
          <priority value="debug" />
          <appender-ref ref="STDOUT" />
          <appender-ref ref="FILELOG" />
     </category>

</log4j:configuration>



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]






---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to