wood burning stoves 2.0*
The moose likes Other Open Source Projects and the fly likes log4j - email Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "log4j - email" Watch "log4j - email" New topic

log4j - email

Muse Ran
Ranch Hand

Joined: Sep 17, 2008
Posts: 317
kindly advise, whats wrong in log4j.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd" >
<appender name="file"
<param name="maxFileSize" value="100KB" />
<param name="maxBackupIndex" value="5" />
<param name="File" value="test.log" />
<param name="threshold" value="info"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern"
value="%d{ABSOLUTE} %5p %c{1}:%L - %m%n" />
<appender name="mail" class="org.apache.log4j.net.SMTPAppender">
<param name="SMTPHost" value="smtp.***.net" />
<param name="From" value="***.***@gmail.com" />
<param name="To" value="***.****@gmail.com" />
<param name="Subject" value="[LOG] ..." />
<param name="BufferSize" value="1" />
<param name="threshold" value="error" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern"
value="%d{ABSOLUTE} %5p %c{1}:%L - %m%n" />
<priority value="debug"></priority>
<appender-ref ref="file" />
<appender-ref ref="mail"/>
<priority value="debug"></priority>
<appender-ref ref="file" />
<appender-ref ref="mail"/>

-------i am getting below error------

log4j:ERROR Parsing error on line 33 and column 3
log4j:ERROR The markup in the document following the root element must be well-formed.
log4j:ERROR Could not parse input source [org.xml.sax.InputSource@76cbf7].
org.xml.sax.SAXParseException: The markup in the document following the root element must be well-formed.
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(Unknown Source)
at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:665)
at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:616)
at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:602)
at org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionConverter.java:460)
at org.apache.log4j.LogManager.<clinit>(LogManager.java:113)
at org.apache.log4j.Logger.getLogger(Logger.java:94)
at LogClass.<clinit>(LogClass.java:4)
log4j:WARN No appenders could be found for logger (LogClass).
log4j:WARN Please initialize the log4j system properly.

please help

Tomorrow will surely be a new day!!!
tapeshwar sharma
Ranch Hand

Joined: Mar 10, 2006
Posts: 245
at a first glance :
</log4j:configuration> appears twice in the given xml.
Btw, these kind of things can be easily detected by the free tools available on the web.
Martijn Verburg

Joined: Jun 24, 2003
Posts: 3274

Hi Muse,

Just a quick tip, in future you can UseCodeTags to highlight sample code, it makes it easier for us to read

As the poster above stated, you've got one too many closing elements

Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
I agree. Here's the link: http://aspose.com/file-tools
subject: log4j - email
Similar Threads
log4j XML properties file problem.
lgo4j configuration problem in JBoss
weired pursing error :log4j
log4j - creating my own file
Separate log file