log4j SMTPAppender -- combining messages into one e-mail?

Discussion in 'Java' started by Mikhail Teterin, Feb 20, 2008.

  1. Hello!

    I'm trying to use log4j's SMTPAppender to get warnings and errors reported
    by our application via e-mail (in addition to having ALL messages saved
    into a file via RollingFileAppender).

    It all works, except for one thing -- every warning/error arrives in its own
    e-mail message...

    The BufferSize parameters appears intended to regulate this, but no matter
    what I set it to (tried different values from 1 to 102400), exactly one
    log-message per e-mail are still generated...

    Any ideas? Thanks!

    -mi

    Here is my current log4.properties file:

    log4j.rootLogger=DEBUG, A1, mail
    log4j.appender.A1=org.apache.log4j.RollingFileAppender
    log4j.appender.A1.File=log.txt
    log4j.appender.R.MaxFileSize=100KB
    log4j.appender.R.MaxBackupIndex=1

    log4j.appender.A1.layout=org.apache.log4j.PatternLayout

    # Pattern to output the caller's file name and line number.
    log4j.appender.A1.layout.ConversionPattern=%d %5p [%t] (%F:%L) - %m%n

    log4j.appender.mail=org.apache.log4j.net.SMTPAppender
    log4j.appender.mail.To=
    log4j.appender.mail.From=
    log4j.appender.mail.SMTPHost=smtp.example.com
    log4j.appender.mail.Threshold=WARN
    log4j.appender.mail.BufferSize=1024000
    log4j.appender.mail.Subject=Testing log4j email
    log4j.appender.mail.layout=org.apache.log4j.HTMLLayout
     
    Mikhail Teterin, Feb 20, 2008
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alexandra Stehman

    eclipse, junit, log4j, & finding log4j.xml

    Alexandra Stehman, Jan 19, 2004, in forum: Java
    Replies:
    0
    Views:
    5,784
    Alexandra Stehman
    Jan 19, 2004
  2. Alex Hunsley
    Replies:
    2
    Views:
    12,947
    =?ISO-8859-15?Q?Fr=E9d=E9ric_G=E9din?=
    May 28, 2004
  3. Rodolfo
    Replies:
    0
    Views:
    959
    Rodolfo
    Jul 12, 2004
  4. Replies:
    0
    Views:
    2,149
  5. aflat362
    Replies:
    1
    Views:
    2,191
    aflat362
    Nov 2, 2006
Loading...

Share This Page