You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by youhaodeyi <yo...@gmail.com> on 2008/05/13 06:16:47 UTC
How can I prevent logger inheriting from root?
I set many appenders to the root logger and set another logger with only one
appender. But the logger will inherit the appenders from root logger. How
can I prevent this?
--
View this message in context: http://www.nabble.com/How-can-I-prevent-logger-inheriting-from-root--tp17200817p17200817.html
Sent from the Log4j - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: Appender events and levels.
Posted by "James A. N. Stauffer" <st...@gmail.com>.
Your info doesn't seem to jive. It appears that you are appending to
the subject in a loop or something to get multiple paranthesis.
On Tue, May 13, 2008 at 4:30 PM, Tasso Angelidis <ta...@paymenttrust.ca> wrote:
> I wrote my own SMTP appender as I required some additional functionality.
>
> Bassically in void append(LoggingEvent event) I want to append the Level to the subject of the email.
>
> String subject = new String("My Subject");
> subject += " (" + event.getLevel().toString() + ")";
>
>
> In my application:
>
> opsLogger.info("test1"); Produces subject: My Subject (ERROR) (INFO)
>
> opsLogger.error("test2"); Produces subject: My Subject (ERROR)
>
> opsLogger.warn("test3"); Produces subject: My Subject (ERROR) (INFO) (WARN)
>
>
> How can I get the appender to only write the specific Level not the hiarchy.
--
James A. N. Stauffer http://www.geocities.com/stauffer_james/
Are you good? Take the test at http://www.livingwaters.com/good/
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Appender events and levels.
Posted by Tasso Angelidis <ta...@paymenttrust.ca>.
I wrote my own SMTP appender as I required some additional functionality.
Bassically in void append(LoggingEvent event) I want to append the Level to the subject of the email.
String subject = new String("My Subject");
subject += " (" + event.getLevel().toString() + ")";
In my application:
opsLogger.info("test1"); Produces subject: My Subject (ERROR) (INFO)
opsLogger.error("test2"); Produces subject: My Subject (ERROR)
opsLogger.warn("test3"); Produces subject: My Subject (ERROR) (INFO) (WARN)
How can I get the appender to only write the specific Level not the hiarchy.
I have log4j configured as follows...
<appender name="log" class="org.apache.log4j.RollingFileAppender">
<param name="Threshold" value="info"/>
...
</appender>
<appender name="error" class="org.apache.log4j.RollingFileAppender">
<param name="Threshold" value="error"/>
...
</appender>
<appender name="ops" class="com.pt.log4j.SMTPAppender">
<param name="Threshold" value="info"/>
...
</appender>
<logger name="operations.com.rbs">
<appender-ref ref="ops"/>
</logger>
<root>
<level value="info" />
<appender-ref ref="log"/>
<appender-ref ref="error"/>
</root>
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: How can I prevent logger inheriting from root?
Posted by Curt Arnold <ca...@apache.org>.
On May 12, 2008, at 11:16 PM, youhaodeyi wrote:
>
> I set many appenders to the root logger and set another logger with
> only one
> appender. But the logger will inherit the appenders from root
> logger. How
> can I prevent this?
Set additivity = false for the logger and events will not be processed
by the parent logger.
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org