At 00:20 03/14/2001 -0500, Peter Lin wrote:

>Do anyone have an example of filtering by class with DOMConfigurator. I
>don't see a filter for it. There's priority and string filter, but no
>class filter.  In the non-xml configuration, the sample given is this.
>
>  log4j.category.org.apache.log4j.examples.SortAlgo.INNER=INFO
>
>if any one has an example or knows of one, can you point to it. thanks
>in advance.
>
>peter



this is an example of what I was using. (I should have a new one soonish 
:-) )   if there is something bad please do blast it into smitherings :-)


I pretty much think in xml and objects and .properties files just make me 
have nightmares. :-)


the problem that I had in pre 1.1b  (I have not gotten to testing in 1.1b 
yet.)  is this:



<!DOCTYPE configuration SYSTEM "log4j.dtd">



<configuration>

         <appender name="defaultThreadLogger" 
class="org.apache.log4j.FileAppender">
                 <param name="File" value="System.out" />
                 <param name="Append" value="true" />

                 <layout class="org.apache.log4j.PatternLayout">
                    <param name="ConversionPattern"
                           value="[%d{HH:mm:ss,SSS}]# [ %-5p] userid: %t %x 
%m \n" />
                 </layout>

         </appender>


<!-- this is of the entire project that everyone else inherits off of -->
         <root>
            <priority value ="error" />
            <appender-ref ref="defaultThreadLogger" />
         </root>


<!-- start of the robots.util PACKAGE -->

         <category name="foo.bar.robots.util">
           <priority value="info" />
<!--      <appender-ref ref="defaultThreadLogger" />   -->
         </category>


<!-- end of the robots.util PACKAGE -->


</configuration>




If you uncomment  <!--            <appender-ref ref="defaultThreadLogger" 
/>   -->    then when foo.bar.robots.util   fires you will get the appender 
"firing" 2x.


it seems that the xml parser inserts the appender-ref into the list of 
appenders without checking to see if that appender is already inserted.  (I 
can't recall if I submitted this as a bug already.  I know I wanted 
to.  but life just blurs and you think you did something but instead it was 
a cafeine induced haze.)





msew


------- see below for the .xml file example ---------



<!-- <!DOCTYPE configuration SYSTEM "log4j.dtd"> -->

<!DOCTYPE configuration SYSTEM "log4j.dtd">



<configuration>

         <appender name="defaultThreadLogger" 
class="org.apache.log4j.FileAppender">
                 <param name="File" value="System.out" />
                 <param name="Append" value="true" />

                 <layout class="org.apache.log4j.PatternLayout">
                    <param name="ConversionPattern"
                           value="[%d{HH:mm:ss,SSS}]# [ %-5p] userid: %t %x 
%m \n" />
                 </layout>

         </appender>


<!-- this is of the entire project that everyone else inherits off of -->
         <root>
            <priority value ="error" />
            <appender-ref ref="defaultThreadLogger" />
         </root>


<!-- start of the robots.util PACKAGE -->

         <category name="foo.bar.robots.util">
           <priority value="info" />
<!--      <appender-ref ref="defaultThreadLogger" />   -->
         </category>


<!-- end of the robots.util PACKAGE -->





<!-- start of the robots.client PACKAGE -->

         <category name="foo.bar.client">
           <priority value="info" />
  <!--     <appender-ref ref="defaultNetworkLogger" />  -->
         </category>


<!-- start of the BootStrap -->
         <category name="foo.bar.client.BootStrap">
           <priority value="info" />
  <!--     <appender-ref ref="defaultNetworkLogger" />  -->
         </category>
<!-- end of the BootStrap -->



<!-- start of the BotThreadImpl -->
         <category name="foo.bar.client.BotThreadImpl">
           <priority value="info" />
  <!--     <appender-ref ref="defaultNetworkLogger" />  -->
         </category>
<!-- end of the BotThreadImpl -->


<!-- end of the robots.client PACKAGE -->





<!-- start of the robots.common.thread PACKAGE -->

         <category name="foo.bar.common.thread">
           <priority value="warn" />
  <!--     <appender-ref ref="defaultThreadLogger" />  -->
         </category>




<!-- start of the PingMessageThreadImpl -->
         <category name="foo.bar.common.thread.PingMessageThreadImpl">
           <priority value="debug" />
  <!--     <appender-ref ref="defaultThreadLogger" />  -->
         </category>

<!-- end of the PingMessageThreadImpl -->



<!-- start of the PingMessageThreadLobbyImpl -->
         <category name="foo.bar.common.thread.PingMessageThreadLobbyImpl">
           <priority value="warn" />
  <!--     <appender-ref ref="defaultThreadLogger" />  -->
         </category>

<!-- end of the PingMessageThreadLobbyImpl -->



<!-- end of the robots.common.thread PACKAGE -->




<!-- start of the robots.common.network PACKAGE -->

         <category name="foo.bar.common.network">
           <priority value="debug" />
  <!--     <appender-ref ref="defaultNetworkLogger" />  -->
         </category>


<!-- start of the RobotNetworkConnectionLobbyImpl -->
         <category 
name="foo.bar.common.network.RobotNetworkConnectionLobbyImpl">
           <priority value="debug" />
  <!--     <appender-ref ref="defaultNetworkLogger" />  -->
         </category>
<!-- end of the RobotNetworkConnectionLobbyImpl -->



<!-- start of the RobotNetworkConnectionLobbyImpl -->
         <category 
name="foo.bar.common.network.RobotNetworkConnectionGameServerImpl">
           <priority value="debug" />
  <!--     <appender-ref ref="defaultNetworkLogger" />  -->
         </category>
<!-- end of the RobotNetworkConnectionLobbyImpl -->



<!-- end of the robots.common.network PACKAGE -->










</configuration>



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

Reply via email to