Use DOMConfigurator.configure for XML files.
On 10/10/05, Rakesh Patel <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Probably something basic but at present my testcase intialises log4j
> like this and it works:
>
> PropertyConfigurator.configure("c:/Projects/FETServer/conf/log4j.propert
> 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="[EMAIL PROTECTED]" />
> <param name="From" value="[EMAIL PROTECTED]"
> />
> <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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]