Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id A02B4200BC1 for ; Wed, 16 Nov 2016 15:24:31 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 9EEF6160B08; Wed, 16 Nov 2016 14:24:31 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id BF5CF160B03 for ; Wed, 16 Nov 2016 15:24:30 +0100 (CET) Received: (qmail 8517 invoked by uid 500); 16 Nov 2016 14:24:29 -0000 Mailing-List: contact log4j-user-help@logging.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Log4J Users List" Reply-To: "Log4J Users List" Delivered-To: mailing list log4j-user@logging.apache.org Received: (qmail 8506 invoked by uid 99); 16 Nov 2016 14:24:29 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 16 Nov 2016 14:24:29 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 539AC180058 for ; Wed, 16 Nov 2016 14:24:29 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -0.321 X-Spam-Level: X-Spam-Status: No, score=-0.321 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_SORBS_SPAM=0.5, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd3-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id u50lUpjhzDJO for ; Wed, 16 Nov 2016 14:24:28 +0000 (UTC) Received: from mail-qk0-f180.google.com (mail-qk0-f180.google.com [209.85.220.180]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id A83F15FAD2 for ; Wed, 16 Nov 2016 14:24:27 +0000 (UTC) Received: by mail-qk0-f180.google.com with SMTP id x190so176696523qkb.0 for ; Wed, 16 Nov 2016 06:24:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:message-id:date:user-agent:mime-version; bh=2Uh5k7UgdAHdagMHW1VGGXtz/nnH87ReeWu4Bs9eYww=; b=E74Ez0gKRoO37Qi5kLzHgO0Kinh31xezDiQhxkzmpyK+jR4xGkSMnF3N7HaRMF0oKv pEfvHuBoGS3uuZp5jEEGN5zNKBrGKGkX/0WXOCQsnYo+q7N7DyabsG+9gr9Xctdbkc5Q 21uDuDcfwpQP2yWuPmp4Ma+5dt+ZlDAFbXYzQa76qDda73/XD+3pq6aX1g5jJDsPGqPu nN2y/+7r1DpBh9tSIUAc3JEfeEG6oa+3LRz/e3+oq4OZQRazUx4l4WFC59atbGUiCoHy nNSU7EKl9UOhrklnERN36mtcVUF6bHKAmKssnsqjmOZelzO4hCM5YQavvBirjhn7iGqo wN+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:message-id:date:user-agent :mime-version; bh=2Uh5k7UgdAHdagMHW1VGGXtz/nnH87ReeWu4Bs9eYww=; b=JsrkCgkxLJaIDY0gT+ymOCS4l012fcYz2bPyCUKFPeuZl0tIWn9iRlbk2+d551eJBt h4VMSxZpn812uBxmAsw1udDW3j/XDup+FJwv8zWQ8ThMoFzdxg5X0cd/ksUoKfOmIEQn HPvYU8n6lHHKhDvLcx7Fr7bbISBzO+2iRbAYiTTEfX1aV/0ItnYOpxTdP4KzUlGrOWJg MIrE64/5cey3Ind7mb6aZDtRGLvMzqyWYc3h2a5zsqU2nJUCyJ8uin2d8IPvm71KPhrL a1KTyc2MUgFwVe2b98EY0VXg29L5bnvjDDFZLfdwcWJNRSTCoPQwDUQs3CIyAypk3t8I RAXA== X-Gm-Message-State: AKaTC03+eJO8Pz3R3hWf5O2v+nX4QvI1cmWquGSMYNxKrEzEhlJm5KJPt7Vb7VgPbBn9mg== X-Received: by 10.55.94.199 with SMTP id s190mr3290725qkb.44.1479306265015; Wed, 16 Nov 2016 06:24:25 -0800 (PST) Received: from Christophers-iMac.local (pool-74-96-79-133.washdc.fios.verizon.net. [74.96.79.133]) by smtp.gmail.com with ESMTPSA id 6sm17795521qke.18.2016.11.16.06.24.23 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 16 Nov 2016 06:24:24 -0800 (PST) From: Christopher Schultz X-Google-Original-From: Christopher Schultz To: log4j-user@logging.apache.org Subject: [log4j 1.x] Batch-sending with SMTPAppender Message-ID: Date: Wed, 16 Nov 2016 09:24:21 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="lK0Up7eR4tLaa6QcOaGNPHQAQXUeCJTku" archived-at: Wed, 16 Nov 2016 14:24:31 -0000 --lK0Up7eR4tLaa6QcOaGNPHQAQXUeCJTku Content-Type: multipart/mixed; boundary="QMFoBWU4hxMGpRxlV2UrEjGASQGXRwbSa"; protected-headers="v1" From: Christopher Schultz To: log4j-user@logging.apache.org Message-ID: Subject: [log4j 1.x] Batch-sending with SMTPAppender --QMFoBWU4hxMGpRxlV2UrEjGASQGXRwbSa Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable All, Apologies if this has been posted before.. I checked the archives but it's hard to search for such terms... lots of stuff comes up. I have an SMTPAppender configured and it's working (mostly) as expected. The only problem is that each log message seems to generate its own separate email message. My use-case is a periodic job where I'd like to send any errors to an email box. Two configuration settings for the SMTPAppender led me to believe that the SMTPAppender might batch emails: 1. BufferSize 2. SendOnClose The javadoc specifically mentions that the BufferSize will affect the number of logging events delivered "in this email" which I assumed meant "each email message". My relevant configuration: log4j.appender.CLIENT.bufferSize=3D500 log4j.appender.CLIENT.sendOnClose=3Dtrue Usually, we get something like 0 - 12 errors per run of this periodic job, so I wouldn't expect to get anywhere near the 500 limit. Ideally, all of those log messages would be batched together and sent when the logger shuts down. At the end of the program, I do one of these: finally { org.apache.log4j.LogManager.shutdown(); } That ought to trigger the SendOnClose behavior and flush anything that hasn't already been sent. Am I missing something in my configuration that is required to send these messages in batches? I'd prefer not to write the logs to a separate file and then use a secondary process to email that log file to the intended recipient. Thanks, -chris --QMFoBWU4hxMGpRxlV2UrEjGASQGXRwbSa-- --lK0Up7eR4tLaa6QcOaGNPHQAQXUeCJTku Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQIcBAEBCAAGBQJYLGwXAAoJEBzwKT+lPKRYCvMP+wVTg3iat2Nz7VZGeZOp+uEB TDsDfM4wrJ/sgA744DwXlvBVidVq1MDkRhm12bIv90YHIinO93T0Dk4rmaz+RmkO MpiRNOnJ8y2TC0tf0gAIiUYSJPKA6jxumuxS+CH9ma1jy/FnBOFwSjrcV4zGBTBx LOoBz0YiYuAZHHPb7OtUkpvZ1a1jm/wSCYpzaxmX/YD9BVcXDM+bMjfcng8I2K47 rHACMy34WkuDeHmxhb1zSOf6qcDZh5xYWayMXwBaSF22WD4kIaB/QVOEtvxSZ94d 2voXhyEb0g6109ZVp28s4Osp8Brro4zGALSzRe5wp0Pbg3xPiqWAI2iPhCapaEa5 FhFjYPoxAb9CJYmXcWpnq9ArMu4aIrY/WQMuIsrjEzZAfTVEDHFxOtxkLebIDunP vs3+kynl+bi5G1csROgfbzbygYz/JxCh+7q3GkTGsZM0jy3JPjT7oTXgzokbXlFQ dLW9M2vyfqE5pDNOpWWuXexZ6TOIAs7oMj0wc11HZRqLNy6ZFCt8pw5HTEc5rECu MDJviR358xm2s+h4KMkqBz0w9hp8rTqgh9MJ6qpempSROajnrwzc5Pli9W06MJGB UusJr35vt+EEl6o2MN9RZmd5hkZ9dbVYyGOPP5b1bXZY3La58zQWPhzxAoVzajZO 1dNJH56QF4EoFjqXACDQ =tLtx -----END PGP SIGNATURE----- --lK0Up7eR4tLaa6QcOaGNPHQAQXUeCJTku--