Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8898677
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T00:40:14+00:00 2026-06-15T00:40:14+00:00

I have configured the log4j xml to send e-mail when an error encounters in

  • 0

I have configured the log4j xml to send e-mail when an error encounters in my application, but still i could not get any mails.Could you please suggest me if i have to do something else other than this configuration.Below is the configuration done in xml file for e-mails

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="true">
<appender name="XMPAYROLAppender"
        class="org.apache.log4j.DailyRollingFileAppender">
        <param name="File" value="log/XMPAYROLLogger.log" />
        <param name="datePattern" value="'.'yyyy-MM-dd" />
        <param name="append" value="true" />
        <param name="Encoding" value="UTF-8" />
        <layout class="org.apache.log4j.PatternLayout">
            <param name="ConversionPattern" value="%d [%t] %-5p %C{1} - %m%n" />
        </layout>
</appender>
<appender name="AdministratorEmail" class="org.apache.log4j.net.SMTPAppender">
  <param name="BufferSize" value="1024" />
  <param name="SMTPHost" value="smtp.gmail.com" />
  <param name="From" value="kiran98373@gmail.com" />
  <param name="To" value="kiran98373@gmail.com.com" />
  <param name="Subject" value="test mail" />
  <layout class="org.apache.log4j.PatternLayout">
    <param name="ConversionPattern"
      value="[%d{ISO8601}]%n%n%-5p%n%n%c%n%n%m%n%n" />
  </layout>
  <filter class="org.apache.log4j.varia.LevelRangeFilter">
    <param name="LevelMin" value="error" />
    <param name="LevelMax" value="fatal" />
  </filter>
</appender>

<logger name="XMPAYROLLogger" additivity="true">
        <level class="org.apache.log4j.Level" value="INFO" />
        <appender-ref ref="XMPAYROLAppender" />
</logger>
</log4j:configuration>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T00:40:15+00:00Added an answer on June 15, 2026 at 12:40 am

    There is SMTPAppender class exists in Log4j which sends an email through SMTP for each logged message.

    <appender name="AdministratorEmail" class="org.apache.log4j.net.SMTPAppender">
      <param name="BufferSize" value="512" />
      <param name="SMTPHost" value="some.email.host.org" />
      <param name="From" value="appname@server.com" />
      <param name="To" value="adminA@server.com,adminB@server.com" />
      <param name="SMTPUsername" value="appname@server.com" />
      <param name="SMTPPassword" value="abcdpassword" />
      <param name="SMTPDebug" value="true" /> 
      <param name="Subject" value="SomeApplication on SomeServer12" />
      <layout class="org.apache.log4j.PatternLayout">
        <param name="ConversionPattern"
          value="[%d{ISO8601}]%n%n%-5p%n%n%c%n%n%m%n%n" />
      </layout>
      <filter class="org.apache.log4j.varia.LevelRangeFilter">
        <param name="LevelMin" value="error" />
        <param name="LevelMax" value="fatal" />
      </filter>
    </appender>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have configured the log4j xml to send e-mail when an error encounters in
I have a spring application that has configured log4j (via xml) and that runs
I have an application for which log4j logging is configured in a log4j.properties file.
I configured log4j SMTPAppender to send emails to me on errors. It works, but
I am using Jboss5.1x I have configured jboss-log4j.xml so I will have a seperate
I have developed a spring application, I want to configure it with apache log4j,
I have configured my application to use the Service configuration Local in the development
I have configured in following way that spring MVC app using Spring 3.1.1.RELEASE web.xml
I have log4j configured in my webapp (which works well) and was looking to
I configured the jboss-log4j.xml as you can see at the example. The problem is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.