Return-Path: X-Original-To: apmail-jackrabbit-dev-archive@www.apache.org Delivered-To: apmail-jackrabbit-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 0AC77F17F for ; Tue, 9 Apr 2013 11:20:19 +0000 (UTC) Received: (qmail 35722 invoked by uid 500); 9 Apr 2013 11:20:18 -0000 Delivered-To: apmail-jackrabbit-dev-archive@jackrabbit.apache.org Received: (qmail 34403 invoked by uid 500); 9 Apr 2013 11:20:17 -0000 Mailing-List: contact dev-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@jackrabbit.apache.org Delivered-To: mailing list dev@jackrabbit.apache.org Received: (qmail 34361 invoked by uid 99); 9 Apr 2013 11:20:16 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 09 Apr 2013 11:20:16 +0000 Date: Tue, 9 Apr 2013 11:20:16 +0000 (UTC) From: "Ceki Gulcu (JIRA)" To: dev@jackrabbit.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (JCR-3564) Possible improvement: use logback's "default value for variables" functionality MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 Ceki Gulcu created JCR-3564: ------------------------------- Summary: Possible improvement: use logback's "default value for variables" functionality Key: JCR-3564 URL: https://issues.apache.org/jira/browse/JCR-3564 Project: Jackrabbit Content Repository Issue Type: Improvement Components: jackrabbit-standalone Affects Versions: 2.6 Reporter: Ceki Gulcu In a recent message [1], a jackrabbit-standalone user complained about not being able to configure logging. The user was complaining about the logs being output into the file "jackrabbit.log_IS_UNDEFINED" . The UNDEFINED suffix is used by logback to indicate that the variable ${jackrabbit.log} was well, undefined. The logback.xml file shipping in jackrabbit-standalone-2.6.0.jar indeed makes use of this variable to define the output target of a FileAppender. After some investigation, in appears that prepareServerLog() method in Main [2] class sets this variable/system property (among other logging related system properties). Thus, I don't really understand how the ${jackrabbit.log} variable can be undefined as it should be defined by prepareServerLog() method. Having said that, I think it would be possible to get rid of the prepareServerLog() method altogether by using logback's "default value for variables" functionality [3]. The variable substitution capabilities of logback are inanely powerful. Variable names as well as default values can be nested, even multiple times. For example, the file property of the FileAppender named jackrabbit could be written as: ${jackrabbit.log:-${repo:-jackrabbit}/log/jackrabbit.log} If the $repo and ${jackrabbit.log} variables are not defined, the file property will be set to "jackrabbit/log/jackrabbit.log". Logback will automatically create missing folders if any. if you wish to use the fully qualified path for ${repo}, then you can set it as a system property and let logback perform the rest of the substitution. Similarly, the root level could be set to INFO by default, but still allow it to be overridden by setting ${log.level}: I hope you find the above helpful, [1] http://markmail.org/message/mriltleg4an6yu4e [2] http://goo.gl/Lf3Ig [3] http://logback.qos.ch/manual/configuration.html#defaultValuesForVariables -- 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