Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Emailing logging reports

  1. #1
    Junior Member
    Join Date
    Feb 2014
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Emailing logging reports

    Hello!

    I've been working on a lesson in logging in Java, formatting in XML. I'm trying to add an appender to e-mail the error log, but can't seem to get it to work. Is there a piece I'm missing? The rest of my appenders are working fine. The error I get is that it cannot create an appender of this type. The console also seems to think that I defined the appender after I call for it, but it is above. Here is what I put together:

    <appender name="EMAIL" class="ch.qos.logback.classic.net.SMTPAppender" >
    <filter class="ch.qos.logback.classic.filter.LevelFilter">
    <level>ERROR</level>
    <onMatch>ACCEPT</onMatch>
    <onMismatch>DENY</onMismatch>
    </filter>

    <SMTPHost>${smtpHost}</SMTPHost>
    <to>${emailRecipient}</to>
    <from>${emailSender}</from>
    <subject>${emailSubject} - Job: ${com.minnesotamutual.jobName}</subject>

    <layout class="ch.qos.logback.classic.PatternLayout">
    <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
    </layout>
    </appender>


    And then call it within the logger:
    <appender-ref ref="EMAIL" />

    Any help is greatly appreciated! I'm very new at this. Thank you!


  2. #2
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,520
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: Emailing logging reports

    Welcome to the forum! Please read this topic to learn how to post code in code or highlight tags and other useful info for newcomers.

    I'll think about a better place for your post and move it if it occurs to me.

Similar Threads

  1. Jasper Reports - Error exporting the text file
    By rameshiit19 in forum Java IDEs
    Replies: 0
    Last Post: July 12th, 2012, 05:26 AM
  2. Purging data in Ad hoc reports
    By Vismaya in forum File I/O & Other I/O Streams
    Replies: 1
    Last Post: September 21st, 2011, 09:24 AM
  3. jasper reports
    By rekha in forum Java SE APIs
    Replies: 2
    Last Post: September 17th, 2011, 12:09 AM
  4. How to make Multiple JUnit reports
    By GodspeedPR in forum Java Theory & Questions
    Replies: 0
    Last Post: July 22nd, 2011, 09:04 AM
  5. try-catch block reports to have an Error that I don't know how to fix
    By baraka.programmer in forum What's Wrong With My Code?
    Replies: 1
    Last Post: June 24th, 2011, 06:27 AM