How to give password in the xml configuration of Log4j to send mail.


I am using Log4j for logging purpose.
It has an configuration file in xml format to configure the SMTPAppender.
I get an error that the client is not authenticated to send mail to this mail server.
How should i  give the user-id and password in this configuration file.

Thanks and Regards,
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


be sure you have configured the SMTPHost

Bye, Giant.
prashant_itAuthor Commented:
i am using an xml configuration file and not a properties file for the SMTPAppender

It is like -
<appender name="EVENT_SMTP" class="">
      <param name="Threshold" value="FATAL"/>
      <param name="To" value="<to address>"/>
      <param name="From" value="<my address>"/>
      <param name="Subject" value="One Fatal Error"/>
      <param name="SMTPHost" value="<server name>"/>
      <param name="BufferSize" value="10"/>
      <layout class="org.apache.log4j.PatternLayout">
            <param name="ConversionPattern" value="[%d{ABSOLUTE},%c
                                             {1}] %m%n"/>
<param name="Username" value="THEuserNAME"/>
<param name="Password" value="THEpassword"/>
Angular Fundamentals

Learn the fundamentals of Angular 2, a JavaScript framework for developing dynamic single page applications.

prashant_itAuthor Commented:

I had tried giving the username and password as specified above but i am getting the following in compilation.

       log4j:WARN No such property [username] in
       log4j:WARN No such property [password] in

try to use: instead of SMTPAppender

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Tx accepting
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.