I have extended Category (MyNewCategory) and have created 2
of my own priorities (NOTIFY and FORCELOG).
I am using XML properties/config files.
I can successfully filter (or set the logging priority) per class (aka category)
using the following:
<category name="a.b.c.d" class="MyNewCategory">
<priority value="NOTIFY" />
</category>
However, the purpose for my NOTIFY priority was to separately filter
that and write it to a NT Event Log Appender. For now, I am using a
FileAppender to write these events to a separate log file.
I have this appender configured as follows:
<!-- Define the NOTIFY_TO_LOG appender -->
<appender name="NOTIFY_TO_LOG" class="org.apache.log4j.FileAppender">
<param name="File" value="log_notification_out.txt"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{ISO8601} XXXX: %m%n"/>
</layout>
<!-- Only write events with Priority=NOTIFY to this appender -->
<filter class="org.apache.log4j.varia.PriorityMatchFilter">
<param name="PriorityToMatch" value="NOTIFY" />
<param name="AcceptOnMatch" value="true" />
</filter>
<filter class="org.apache.log4j.varia.DenyAllFilter">
</filter>
</appender>
If I change the PriorityToMatch value to INFO, then I get all my INFO logs
to go to this file using the format specified in the ConversionPattern.
Therefore, I suspect that my XML is setup properly.
Inspection of org.apache.log4j.spi.LoggingEvent.java shows that it says
" <p>This class is of concern to those wishing to extend log4j. ".
However, I am at a loss to understand how I should proceed.
1) Should I *modify* the file and change all usages of Category to MyNewCategory ?
Would then I need to modify all the caller's to pass in a MyNewCategory ?
2) Should I attempt to check if the given category object is really a MyNewCategory
object ?
3) Or more likely, I have no real clue !! <grin>
Any and all help would be appreciated.
Thanks
----------------------------------------------------------------
Jay Riddell
Dorado Software
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]