logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rakesh Patel" <Rakesh.Pa...@sharepeople.com>
Subject RE: Switching to XML configuration does not work
Date Mon, 10 Oct 2005 13:37:10 GMT
Hi,

So I change to DOMConfigurator and find that its been deprecated in 1.3.
Ok, so I check the API and now I need to use the JoranConfigurator.
Finding an example is hard and eventually find a testcase in the log4j
cvs repository:

JoranConfigurator jc = new JoranConfigurator();
 
jc.doConfigure("c:/Projects/FETServer/conf/log4j.xml",
LogManager.getLoggerRepository());

Next problem - no sign of the SMTPAppender!!!! Its not in the latest
alpha release(6) but I can see it in the HEAD!!!! ARRRGGGHHH!!!!!! I did
actually compile my own but didn't include the mail stuff because I
didn't think I'd need it and that's why I switched back to alpha 6.

So, do I now create my own compiled version of the latest code and
include it this time???

Rakesh

-----Original Message-----
From: James Stauffer [mailto:stauffer.james@gmail.com] 
Sent: 10 October 2005 13:51
To: Log4J Users List
Subject: Re: Switching to XML configuration does not work


Use DOMConfigurator.configure for XML files.

On 10/10/05, Rakesh Patel <Rakesh.Patel@sharepeople.com> wrote:
> Hi,
>
> Probably something basic but at present my testcase intialises log4j 
> like this and it works:
>
> PropertyConfigurator.configure("c:/Projects/FETServer/conf/log4j.prope
> rt
> ies");
>
> Now I want to swap to XML file configuration (only because I could not

> get SMTPAppender working and found xml examples!). So I changed the
> code:
>
> PropertyConfigurator.configure("c:/Projects/FETServer/conf/log4j.xml")
> ;
>
> However, there's no logging of my app anymore so I think its not 
> finding the xml file.
>
> Anyone know whats wrong?
>
> Thanks
>
> Rakesh
>
> PS here's my log4j.xml file
>
> <?xml version="1.0" encoding="UTF-8" ?>
> <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
>
> <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
>
>     <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
>         <layout class="org.apache.log4j.PatternLayout">
>             <param name="ConversionPattern"
>                 value="%p - %C{1}.%M(%L) | %m%n"/>
>         </layout>
>     </appender>
>
>     <appender name="EMAIL" class="org.apache.log4j.net.SMTPAppender">
>
>                 <param name="Threshold" value="ERROR" />
>                 <param name="To" value="rakesh.patel@sharepeople.com"
/>
>                 <param name="From" 
> value="rakesh.patel@sharepeople.com"
> />
>                 <param name="Subject"
>                         value="Subject here" />
>                 <param name="SMTPHost" value="195.110.64.110" />
>
>                 <layout class="org.apache.log4j.PatternLayout">
>                         <param name="ConversionPattern"
>                                 value="[%d{ISO8601}] %-5p %c %m %n" />
>                 </layout>
>
>         </appender>
>
>     <logger name="org.apache.struts">
>         <level value="WARN"/>
>     </logger>
>
>     <logger name="org.apache.commons">
>         <level value="WARN"/>
>     </logger>
>
>     <logger name="net.sf.hibernate">
>         <level value="WARN"/>
>     </logger>
>
>         <logger name="my.apps.domain">
>         <level value="WARN"/>
>     </logger>
>
>     <root>
>         <level value="WARN"/>
>         <appender-ref ref="CONSOLE"/>
>                 <appender-ref ref="EMAIL"/>
>     </root>
>
> </log4j:configuration>
>
>
>
> American Express Investments and American Express Independent 
> Financial Advisers are marketing names for American Express Financial 
> Services Europe Limited, a separate corporation within the American 
> Express group of companies.  American Express Financial Services 
> Europe Limited is authorised and regulated by, and is entered into the

> register (No. 190853 www.fsa.gov.uk/register/) of, the Financial 
> Services Authority and a member of the London Stock Exchange. 
> Registered in England No. 3614902. Registered address: 230 Blackfriars

> Road, London SE1 8NW. Vat No. 740 4143 68.
>
> The information in this email and any attachments is confidential and 
> intended solely for the attention and use of the named addressee(s). 
> It may be subject to legal, professional or other privilege and 
> further distribution of it is strictly prohibited without our 
> authority.  If you are not the intended recipient, you are not 
> authorised to and must not disclose, copy, distribute, or retain this 
> message or any part of it, and should notify us immediately.
>
>
>


--
James Stauffer
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



American Express Investments and American Express Independent Financial Advisers are marketing
names for American Express Financial Services Europe Limited, a separate corporation within
the American Express group of companies.  American Express Financial Services Europe Limited
is authorised and regulated by, and is entered into the register (No. 190853 www.fsa.gov.uk/register/)
of, the Financial Services Authority and a member of the London Stock Exchange. Registered
in England No. 3614902. Registered address: 230 Blackfriars Road, London SE1 8NW. Vat No.
740 4143 68. 

The information in this email and any attachments is confidential and intended solely for
the attention and use of the named addressee(s). It may be subject to legal, professional
or other privilege and further distribution of it is strictly prohibited without our authority.
 If you are not the intended recipient, you are not authorised to and must not disclose, copy,
distribute, or retain this message or any part of it, and should notify us immediately.


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


Mime
View raw message