logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Norbert Toth-Gati" <norbert.tothg...@gmail.com>
Subject Re: How do I configure Log4J to send different levels to different appenders
Date Wed, 04 Jul 2007 09:48:44 GMT
Hi Mikael,

You may try to configure the following categories:

    <category name="com.mycompany">
        <priority value="DEBUG"/>
        <appender-ref ref="MAIN_LOG"/>
        <appender-ref ref="DEBUG_LOG"/>
    </category>

    <category name="com.othercompany">
        <priority value="WARN"/>
        <appender-ref ref="MAIN_LOG"/>
    </category>

    <category name="com.othercompany">
        <priority value="DEBUG"/>
        <appender-ref ref="DEBUG_LOG"/>
    </category>

You may need to configure all the thirdparty logs to end up in the following
appenders:

    <category name="org.thirdparty">
        <priority value="ERROR"/>
        <appender-ref ref="MAIN_LOG"/>
    </category>
    <category name="org.thirdparty">
        <priority value="INFO"/>
        <appender-ref ref="DEBUG_LOG"/>
    </category>

Hope that helps.

Regards,
Norbert



On 7/4/07, Mikael Ståldal <mikael.staldal@univits.com> wrote:
>
> I have two appenders, MAIN_LOG and DEBUG_LOG. I have the loggers set up to
> match Java class
> hierarchy as recommended. I have two interesting codebases, "com.mycompany"
> and
> "com.othercompany".
>
> I want to send DEBUG and higher from "com.mycompany" and WARN and higher
> from
> "com.othercompany" to MAIN_LOG. And I want to send DEBUG and higher from "
> com.mycompany" and
> DEBUG and higher from "com.othercompany" to DEBUG_LOG.
>
> Finally I want to handle stuff outside "com.mycompany" or "
> com.othercompany" (such as
> "org.thirdparty") by sending ERROR and higher to MAIN_LOG and INFO and
> higher to DEBUG_LOG.
>
> How do I accomplish that?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message