Return-Path: X-Original-To: apmail-directory-dev-archive@www.apache.org Delivered-To: apmail-directory-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 9BE10EE34 for ; Fri, 15 Feb 2013 11:51:19 +0000 (UTC) Received: (qmail 49732 invoked by uid 500); 15 Feb 2013 11:51:19 -0000 Delivered-To: apmail-directory-dev-archive@directory.apache.org Received: (qmail 49445 invoked by uid 500); 15 Feb 2013 11:51:15 -0000 Mailing-List: contact dev-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Apache Directory Developers List" Delivered-To: mailing list dev@directory.apache.org Received: (qmail 49394 invoked by uid 99); 15 Feb 2013 11:51:13 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 15 Feb 2013 11:51:13 +0000 Date: Fri, 15 Feb 2013 11:51:12 +0000 (UTC) From: "Piotr Kubowicz (JIRA)" To: dev@directory.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (DIRSERVER-1804) [patch] Fix ApacheDS code to allow control and reduce number of outputted logs MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/DIRSERVER-1804?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13579118#comment-13579118 ] Piotr Kubowicz commented on DIRSERVER-1804: ------------------------------------------- Thank you. > [patch] Fix ApacheDS code to allow control and reduce number of outputted logs > ------------------------------------------------------------------------------ > > Key: DIRSERVER-1804 > URL: https://issues.apache.org/jira/browse/DIRSERVER-1804 > Project: Directory ApacheDS > Issue Type: Bug > Affects Versions: 2.0.0-M10 > Reporter: Piotr Kubowicz > Labels: log4j, log4j-over-slf4j > Attachments: slf4j-logging.patch > > > I am using Maven artifact apacheds-all version 2.0.0-M10 (http://mvnrepository.com/artifact/org.apache.directory.server/apacheds-all/2.0.0-M10). > I want to start and stop the server from my Java code (in a way similar to the one described in the official 'embedded sample': http://svn.apache.org/repos/asf/directory/documentation/samples/trunk/embedded-sample/src/main/java/org/apache/directory/seserver/EmbeddedADSVer157.java). > The problem is: ApacheDS start takes 7 minutes and recuces to 3 seconds when standard output is redirected to /dev/null. Reason: you make lots of debug-level logging which take 99.9% of the startup time. > I would like to restrict logging from ApacheDS to ERROR level. However, it is not possible because of the flawed ApacheDS code. > You use SLF4J loggers this way: > private static final Logger LOG = LoggerFactory.getLogger( JdbmIndex.class.getSimpleName() ); > This is absolutely *unacceptable*. The result of this code that the logger would be created for name 'JdbmIndex' and there is no way to use logger inheritance to control all logging from ApacheDS code, without affecting my own code. I don't want to look through ApacheDS code, find classes that fail to use logging correctly and silence each of these classes one by one in my own logging configuration. > The correct way for using logging in Java is to use: > private static final Logger LOG = LoggerFactory.getLogger( JdbmIndex.class ); > Then the logger would be created for name 'org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmIndex' and I would be able to silence the whole 'org.apache.directory' or just 'org.apache.directory.server.core.partition' - or any part I like. > ---- > I created a patch based on the today version of trunk. It introduces a single correct way of creating loggers across all ApacheDS code. I have also updated your logging configuration in log4j.properties to make sure the application behaviour won't change after my fixes. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira