Return-Path: X-Original-To: apmail-commons-user-archive@www.apache.org Delivered-To: apmail-commons-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 8D7AA8C38 for ; Fri, 26 Aug 2011 21:52:08 +0000 (UTC) Received: (qmail 61779 invoked by uid 500); 26 Aug 2011 21:52:07 -0000 Delivered-To: apmail-commons-user-archive@commons.apache.org Received: (qmail 61619 invoked by uid 500); 26 Aug 2011 21:52:06 -0000 Mailing-List: contact user-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Commons Users List" Delivered-To: mailing list user@commons.apache.org Received: (qmail 61611 invoked by uid 99); 26 Aug 2011 21:52:06 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 26 Aug 2011 21:52:06 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of knst.kolinko@gmail.com designates 209.85.220.171 as permitted sender) Received: from [209.85.220.171] (HELO mail-vx0-f171.google.com) (209.85.220.171) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 26 Aug 2011 21:52:02 +0000 Received: by vxh13 with SMTP id 13so3969491vxh.30 for ; Fri, 26 Aug 2011 14:51:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=atfNEnO6Y+vl2BHtGn7iVAdArGUrpO7u75fLFQrnPcw=; b=AK85FlLXrA7s/TYQVmH9nTtGmFLZPgx3KmX2e5VZqUi6zQETOpkOzr16VAOJW2UUkH 64eiGJ+N3q0Ox+ncexQcM6CkVKiCTX1TxXCHqDCReRa/mblQ8cYLTb7tuStMSzNNpGm3 qxWmAb21xriO8tK2XYjWVFLTGK6pSCR1aA5Vk= MIME-Version: 1.0 Received: by 10.52.94.18 with SMTP id cy18mr1785768vdb.101.1314395501284; Fri, 26 Aug 2011 14:51:41 -0700 (PDT) Received: by 10.52.185.106 with HTTP; Fri, 26 Aug 2011 14:51:41 -0700 (PDT) In-Reply-To: <5A0C9295C311114BB11147A04451FFB409F403ADF0@MB-NCR-126.ad.pwgsc-tpsgc.gc.ca> References: <1495947657.62512.1313764211097.JavaMail.root@mbox03.in.post.sk> <5A0C9295C311114BB11147A04451FFB409F403ADF0@MB-NCR-126.ad.pwgsc-tpsgc.gc.ca> Date: Sat, 27 Aug 2011 01:51:41 +0400 Message-ID: Subject: Re: [daemon] Odd user.dir behaviour with procrun / log4j From: Konstantin Kolinko To: Commons Users List Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 2011/8/19 Jacob Zwiers : > I have installed a java batch process using the version of procrun that s= hips with tomcat 5.5.33: > > =A0 Commons Daemon Service Runner version 1.0.5.0/Win32 (Jan =A05 2011) > =A0 Copyright (c) 2000-2011 The Apache Software Foundation. > > In the installation, I specify (among other JVM options): > =A0--JvmOptions=3D"-Duser.dir=3DC:\LOCAL\serverapps" > > My log4j.properties configuration includes: > =A0 log4j.appender.InfoLogFile.File=3D../logs/info.log > > However, the info.log file is being written to: > =A0 C:\WINDOWS\logs > > I've checked the value of user.dir at many different points and it's alwa= ys "C:\LOCAL\serverapps". > > But, log4j is behaving as if user.dir=3D"C:\Windows\System32" (or some ot= her subir of C:\Windows). > > From what I can tell from the log4j source (1.2.16), the FileAppender dea= ls only with the java.io.FileOutputStream and File classes which claim to m= ake paths relative from the user.dir location. > > I've worked around the issue, but I am curious: =A0has anyone else has en= countered this type of behaviour? > 1. I think java.io uses OS-level API to open files and resolve non-absolute paths into absolute ones, and your hacky attempt to set user.dir property does not affect OS. 2. There is --StartPath option in procrun (see SO_STARTPATH in prunsrv.c). I think it might be that it will allow to configure working directory. I have not tested though. 3. I might be that you can define your own variable and reference it in log4j.properties. I have not tested it though. You wrote that you have already worked around your original problem. Best regards, Konstantin Kolinko --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@commons.apache.org For additional commands, e-mail: user-help@commons.apache.org