Return-Path: X-Original-To: apmail-logging-log4j-user-archive@www.apache.org Delivered-To: apmail-logging-log4j-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8A9A517F2C for ; Sun, 19 Apr 2015 16:27:41 +0000 (UTC) Received: (qmail 33478 invoked by uid 500); 19 Apr 2015 16:27:39 -0000 Delivered-To: apmail-logging-log4j-user-archive@logging.apache.org Received: (qmail 33442 invoked by uid 500); 19 Apr 2015 16:27:39 -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 33431 invoked by uid 99); 19 Apr 2015 16:27:39 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 19 Apr 2015 16:27:39 +0000 X-ASF-Spam-Status: No, hits=3.2 required=5.0 tests=HTML_MESSAGE,SPF_SOFTFAIL X-Spam-Check-By: apache.org Received-SPF: softfail (athena.apache.org: transitioning domain of garydgregory@gmail.com does not designate 54.191.145.13 as permitted sender) Received: from [54.191.145.13] (HELO mx1-us-west.apache.org) (54.191.145.13) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 19 Apr 2015 16:27:34 +0000 Received: from mail-wi0-f169.google.com (mail-wi0-f169.google.com [209.85.212.169]) by mx1-us-west.apache.org (ASF Mail Server at mx1-us-west.apache.org) with ESMTPS id 924AE20DB8 for ; Sun, 19 Apr 2015 16:27:14 +0000 (UTC) Received: by wiun10 with SMTP id n10so67071059wiu.1 for ; Sun, 19 Apr 2015 09:27:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=4ioYgRzgOkHrNyCatUhz9zvdsgNtVbskDTc4RiapFik=; b=ZpBaymyTA4usgM4/KV2tW3YV+mh6XEPWWGVQ8IryPmfvBLB0tmMn+bF3K7Gn6AP29C CrSSeDD3y7nTHFkpDVSS/1s0sD7sC5tIhlAVulmRhZRlVSTkg0Am/e1gwAuSyRzqk74+ PwcTP/biIdZdML7abkDOU0iJ8OvZAcP+FfUul59+JY1j9ahzYLLqg5ptaBEmWl8rJc9r BGrJruZAVuexG0nG2rbz0dls35gxatZ9H4VxaQIQmmJJwEIdPuEKpyz0DemCS72kF2J7 cWhwAvAfjNBGH48Pxq+ybWiu4AUMlLEYaCswAVzoaEDBkSgLpdLXbdBjRT2BUZ2274te QUbA== MIME-Version: 1.0 X-Received: by 10.180.99.42 with SMTP id en10mr18425622wib.83.1429460826830; Sun, 19 Apr 2015 09:27:06 -0700 (PDT) Received: by 10.27.83.211 with HTTP; Sun, 19 Apr 2015 09:27:06 -0700 (PDT) In-Reply-To: <1335151456.7227046.1429435652730.JavaMail.yahoo@mail.yahoo.com> References: <1335151456.7227046.1429435652730.JavaMail.yahoo@mail.yahoo.com> Date: Sun, 19 Apr 2015 09:27:06 -0700 Message-ID: Subject: Re: Memory leak by not disposing loggers From: Gary Gregory To: Log4J Users List , Veselin M Content-Type: multipart/alternative; boundary=f46d04428100cdbb150514164807 X-Virus-Checked: Checked by ClamAV on apache.org --f46d04428100cdbb150514164807 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable The LoggerContext.loggers is a ConcurrentHashMap. It sounds like you need the effect of a ConcurrentHashMap with weak values... Gary On Sun, Apr 19, 2015 at 2:27 AM, Veselin M wrote: > Hello all, > > I have a memory leak problem with Log4j2. I=E2=80=99m using SLF4J to get = loggers > for my objects. Unfortunately when they get garbage collected the logger > remains cached in LoggerContext.loggers in the log4j framework. Is there > any way to prevent the caching or to remove the logger? > > Regards > Veselin > > --------------------------------------------------------------------- > To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org > For additional commands, e-mail: log4j-user-help@logging.apache.org > > --=20 E-Mail: garydgregory@gmail.com | ggregory@apache.org Java Persistence with Hibernate, Second Edition JUnit in Action, Second Edition Spring Batch in Action Blog: http://garygregory.wordpress.com Home: http://garygregory.com/ Tweet! http://twitter.com/GaryGregory --f46d04428100cdbb150514164807--