Setting a priority for a category limits which log messages are forwarded to the appenders. Thus, for both com.mycompany.package1 and com.mycompany.package2 only ERROR messages get logged.
The root definition identifies the appenders to use for all log messages, thus all messages are sent to SMTP, CONSOLE and FILE. In addition, log messages for com.mycompany.package1 are sent a second time to CONSOLE - the messages were sent the first time to CONSOLE because all categories inherit from root. This point confused me the first time I ran into it also.
ah, ok makes sense.
There isnt a way to override appenders on a per-category basis then? Ideally, I want to log ERROR to SMTP, CONSOLE and FILE for everything except for 1 or 2 categories, which I only want logged to CONSOLE / FILE - would have to have a more verbose config to achieve this then?
Ideally, I want to log ERROR to SMTP, CONSOLE and FILE for everything except for 1 or 2 categories, which I only want logged to CONSOLE / FILE
The "additivity" flag on a category will help in achieving this. Ex:
<category name="com.mycompany.package1" additivity="false"> <priority value="ERROR" /> <appender-ref ref="CONSOLE" /> </category> <category name="com.mycompany.package2"> <priority value="ERROR" /> </category> <root> <priority value="INFO" /> <appender-ref ref="SMTP" /> <appender-ref ref="CONSOLE" /> <appender-ref ref="FILE" /> </root>
Here com.mycompany.package1 will log only to the CONSOLE because the additivity flag is set to false. That flag can be used to specify that the log messages of a particular category are not to be propagated to the parent categories (the root in this case).
instant reply seems broken :( or theres something funky in my cache.