logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mandar Mangalvedhekar" <mmangalvedhe...@us-south.net>
Subject RE: Having mixed loggers in log4j.xml ?
Date Mon, 10 Nov 2003 17:31:33 GMT

Here is what is happening.

I have a Emailer (logger name) and I am adding FileAppender and
SMTPAppender to this logger.

The SMTPAppender never gets called. The message is getting logged to the
file. Both the appenders work if I use a class name instead of string.

I am not sure what I am missing.

Here is the log4j.xml file

---------------------------------------------

<appender name="BFile" class="org.apache.log4j.FileAppender">
      <param name="Append" value="true"/>
      <param name="File" value="test.log"/>
   
      <layout class="org.apache.log4j.PatternLayout">
        <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}]
%m%n"/>
      </layout>
  </appender>	

   <appender name="BAlert" class="org.apache.log4j.net.SMTPAppender">
    <param name="Threshold" value="ERROR"/>
     ......	
  </appender>
  
  <appender name="BNoFileAlert"
class="org.apache.log4j.net.SMTPAppender">
  		<param name="Threshold" value="INFO"/>
	........
  </appender>

  <logger name="a.b.c.Main" additivity="false">
    <level value="INFO"/>
    <appender-ref ref="BFile"/>
    <appender-ref ref="BAlert"/>
 </logger>	
  
  <logger name="Emailer" additivity="false">
      <level value="INFO"/>
      <appender-ref ref="BFile"/>
      <appender-ref ref="BNoFileAlert"/>
  </logger>	

---------------------------------------------

Thanks
Mandar



-----Original Message-----
From: Shapira, Yoav [mailto:Yoav.Shapira@mpi.com] 
Sent: Monday, November 10, 2003 12:22 PM
To: Log4J Users List
Subject: RE: Having mixed loggers in log4j.xml ?



Howdy,
Yup, it's allowed.  The name is just a String, doesn't have to be a
class name.  Of course, if you don't actually have anything that does
Logger logger = Logger.getLogger("StringLogger") in your code, the
StringLogger will never be used and thus is meaningless in the
configuration ;)

Yoav Shapira
Millennium ChemInformatics


>-----Original Message-----
>From: Mandar Mangalvedhekar [mailto:mmangalvedhekar@us-south.net]
>Sent: Monday, November 10, 2003 12:21 PM
>To: log4j-user@jakarta.apache.org
>Subject: Having mixed loggers in log4j.xml ?
>
>Hi,
> Can we have a mixture of loggers in log4j.xml file ?
>
>Some of the loggers are actual classes in the application
>
> a.b.c.Test.class
>
> <logger name="a.b.c.Test">
> ...
> </logger>
>
>while some others are plain strings
>
> <logger name="StringLogger">
>  ......
></logger>
>
>
>Is this allowed ?
>
>Thanks
>Mandar
>
>
>



This e-mail, including any attachments, is a confidential business
communication, and may contain information that is confidential,
proprietary and/or privileged.  This e-mail is intended only for the
individual(s) to whom it is addressed, and may not be saved, copied,
printed, disclosed or used by anyone else.  If you are not the(an)
intended recipient, please immediately delete this e-mail from your
computer system and notify the sender.  Thank you.


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org


Mime
View raw message