From log4j-user-return-28987-archive-asf-public=cust-asf.ponee.io@logging.apache.org Fri Jul 6 19:50:54 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id E43EC180627 for ; Fri, 6 Jul 2018 19:50:53 +0200 (CEST) Received: (qmail 13126 invoked by uid 500); 6 Jul 2018 17:50:52 -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 13115 invoked by uid 99); 6 Jul 2018 17:50:52 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 Jul 2018 17:50:52 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 44841CEFB8 for ; Fri, 6 Jul 2018 17:50:52 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -0.102 X-Spam-Level: X-Spam-Status: No, score=-0.102 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd1-us-west.apache.org (amavisd-new); dkim=pass (1024-bit key) header.d=elyograg.org Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id P-VIOjovgpeF for ; Fri, 6 Jul 2018 17:50:50 +0000 (UTC) Received: from frodo.elyograg.org (frodo.elyograg.org [166.70.79.217]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id ECBB15F288 for ; Fri, 6 Jul 2018 17:50:47 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by frodo.elyograg.org (Postfix) with ESMTP id E1A0B192 for ; Fri, 6 Jul 2018 11:50:32 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=elyograg.org; h= content-language:content-transfer-encoding:content-type :content-type:in-reply-to:mime-version:user-agent:date:date :message-id:from:from:references:subject:subject:received :received; s=mail; t=1530899432; bh=UDxlR2GPrFSLIxTAOyPOsJryDVHu pQEhggu6FYfe9bQ=; b=ggfHfAzQXkVRgYg81LoigtvrX3rWmOccDkcuRmLGMYxU ySpbsxQ2UxcXbegq8iNRwH+o+VAex/sLvxewqSebbK3CP920kk5RGf+CqTGo5v6l diOCZ/0l1hrbYWo6sRwRz3FIRphmb3IYIawOzf1t/oIUWcLBLdkEla42R3C71rI= X-Virus-Scanned: Debian amavisd-new at frodo.elyograg.org Received: from frodo.elyograg.org ([127.0.0.1]) by localhost (frodo.elyograg.org [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id cG9rf5yvoMu8 for ; Fri, 6 Jul 2018 11:50:32 -0600 (MDT) Received: from [10.2.0.108] (client175.mainstreamdata.com [209.63.42.175]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: elyograg@elyograg.org) by frodo.elyograg.org (Postfix) with ESMTPSA id 71784165 for ; Fri, 6 Jul 2018 11:50:30 -0600 (MDT) Subject: Re: Odd problem starting program with log4j2 on Windows To: log4j-user@logging.apache.org References: <8ae9dfec-5875-9b9b-156a-b22bea4e100e@elyograg.org> <5BEF0CA4-A0F1-494C-9265-1D62D23B5CF4@dslextreme.com> <2D234518-48BA-4600-863D-BCFFBA359C9B@gmail.com> From: Shawn Heisey Message-ID: <15945d43-4768-2686-2892-c317489e2654@elyograg.org> Date: Fri, 6 Jul 2018 11:50:23 -0600 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.0 MIME-Version: 1.0 In-Reply-To: <2D234518-48BA-4600-863D-BCFFBA359C9B@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Content-Language: en-US On 7/5/2018 8:34 PM, Remko Popma wrote: > I found that the problem can be reproduced with this: > > new File(“file:C:\\temp\\some.file”).toURI() > > If you print the above it shows: > > file:/C:/my/current/directory/file:C:/temp/some.file > > > So, the configuration should not prefix the path with “file:”, but with “file:/“ (slash after the colon). Thanks to everyone who has replied, the discussion is valuable to me. If I add //, it works with absolute paths on log4j2 when running on Windows.  I haven't checked Linux, but I suspect it would work there too. But the URI without // works on Linux in log4j2.  I haven't tested, but I think that I would be able to use a relative path on Linux with the "file:" prefix. The file: URI without // works on both Linux AND Windows in log4j 1.x.  I can use relative paths with either OS when using log4j 1.x.  Something has changed from log4j 1.x to 2.x, something that works without problems on Linux but breaks on Windows.  I think it's been well demonstrated that the problem is in Java, not log4j. For fixing the problem in Solr on Windows, I see two possibilities: One fix (which I know works) is to abandon the file: prefix entirely.  In the Solr startup script, the location is an absolute path.  But I do have some worries that this might break in a future version.  In  log4j 1.x the "file:" prefix appears to be mandatory -- if I remove it from the log4j.configuration system property, my logging configuration isn't found.  With log4j 2.x, the system property is different -- log4j.configurationFile instead of log4j.configuration ... which suggests that URI syntax won't be required. The other fix is to add slashes after file: ... but I'm not sure whether it should be two slashes or three slashes.  Experiments with Path#toUri() suggest that three slashes might be the preferred canonical form, but I'd like to know for sure.  Two slashes does appear to work with log4j. Tangent:  Has there been any desire in the project to abandon the File object and switch to NIO2?  Lucene made that plunge a while back.  I've heard that it's a much better API. Experiments with 'new URI(string)' seem to indicate that log4j (both 1.x and 2.x) accepts URI variations that are not allowed by the URI object.  A prefix of "file://" with a Windows path isn't allowed -- it requires "file:///" to work.  Because the Windows command shell provides paths with backlashes, it would be difficult to specify a completely valid URI -- backslashes do not appear to be allowed in strict syntax. Thanks, Shawn --------------------------------------------------------------------- To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org For additional commands, e-mail: log4j-user-help@logging.apache.org