Thanks. I had not thought of using "localhost" in the url earlier. This will make the url generation easier. Naresh
-----Original Message----- From: Arthur Lim [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 28, 2003 4:28 AM To: 'Ant Users List'; Jacob Kjome Subject: RE: Re[2]: How to get paths with forward slashes Hi, Here's a segment of what you might want to convert the file path from one format to another. In this segment, I am converting from DOS format to UNIX format. Hope this helps. Arthur =========================================== <property name="MY_APPS" value="C:\MY_APPS\application"/> <!-- CONVERT OS DEPENDENT PATH TO URL COMPLIANT --> <path id="os.my.apps"> <pathelement location="/${MY_APPS}"/> </path> <pathconvert targetos="unix" property="url.path" refid="os.my.apps"/> <replace file="${SAVI_APPS}/properties/sc/datacenter.properties"> <replacefilter token="@DTD_URL@" value="file://localhost${url.path}/web/sc/dtd/xrd.dtd" /> </replace> -----Original Message----- From: Naresh Bhatia [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 28, 2003 2:53 AM To: Ant Users List; Jacob Kjome Subject: RE: Re[2]: How to get paths with forward slashes Hi Jake, Thanks for the info. The Think Again article was a great read! But I think the problem is with log4j. I removed the commons-logging API calls completely - it is not even in my classpath any more, but log4j still does not like the backslashes :-(. I get the same error! I am using log4j version 1.2.7 which is the latest. Naresh -----Original Message----- From: Jacob Kjome [mailto:[EMAIL PROTECTED]] Sent: Monday, January 27, 2003 12:49 PM To: Ant Users List Subject: Re[2]: How to get paths with forward slashes Hello Naresh, The one difference between your setup and mine is that I don't use commons-logging. Please try this with Log4j directly. In addition, you might want to read this: http://qos.ch/logging/thinkAgain.html Jake Monday, January 27, 2003, 10:52:53 AM, you wrote: NB> Well, I am using Ant's Copy task with a filterset to generate my NB> log4j.xml. The file is correctly generated with the following line NB> to specify the log file: NB> <param name="File" value="C:\MyProject\log\test.log"/> NB> However, when log4j reads this file it interprets the back slashes NB> as escape characters. I don't think in XML we have to escape the NB> backslashs, but in either case I don't know how to do this with Ant. NB> The error generated by log4j is shown below. Note that it thinks NB> that the filename is "C:MyProjectlog est.log"! NB> log4j:ERROR setFile(null,false) call failed. NB> java.io.FileNotFoundException: C:MyProjectlog est.log (The filename, NB> directory name, or volume label syntax is incorrect) NB> at java.io.FileOutputStream.open(Native Method) NB> at java.io.FileOutputStream.<init>(FileOutputStream.java:102) NB> at org.apache.log4j.FileAppender.setFile(FileAppender.java:272) NB> at NB> org.apache.log4j.RollingFileAppender.setFile(RollingFileAppender.jav NB> a:15 NB> 6) NB> at NB> org.apache.log4j.FileAppender.activateOptions(FileAppender.java:151) NB> at NB> org.apache.log4j.config.PropertySetter.activate(PropertySetter.java:247) NB> at NB> org.apache.log4j.xml.DOMConfigurator.parseAppender(DOMConfigurator.java: NB> 210) NB> at NB> org.apache.log4j.xml.DOMConfigurator.findAppenderByName(DOMConfigurator. NB> java:140) NB> at NB> org.apache.log4j.xml.DOMConfigurator.findAppenderByReference(DOMConfigur NB> ator.java:153) NB> at NB> org.apache.log4j.xml.DOMConfigurator.parseChildrenOfLoggerElement(DOMCon NB> figurator.java:415) NB> at NB> org.apache.log4j.xml.DOMConfigurator.parseCategory(DOMConfigurator.java: NB> 335) NB> at NB> org.apache.log4j.xml.DOMConfigurator.parse(DOMConfigurator.java:788) NB> at NB> org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:67 NB> 3) NB> at NB> org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:61 NB> 6) NB> at NB> org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:60 NB> 2) NB> at NB> org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionConver NB> ter.java:460) NB> at org.apache.log4j.LogManager.<clinit>(LogManager.java:113) NB> at org.apache.log4j.Category.getInstance(Category.java:514) NB> at NB> org.apache.commons.logging.impl.Log4jFactory.getInstance(Log4jFactory.ja NB> va:153) NB> at NB> org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImp NB> l.java:285) NB> at NB> org.apache.commons.logging.LogFactory.getLog(LogFactory.java:409) NB> at NB> org.framework.config.test.ConfigTest.<clinit>(ConfigTest.java:19) NB> BTW, based on Dominique Devienne's suggestion in this thread, I have NB> used <pathconvert> to workaround this problem, but it is still a NB> little messy. <pathconvert> needs to be inside a target - it is not NB> as easy as setting a property anywhere in the build file. NB> Thanks. NB> Naresh NB> -----Original Message----- NB> From: Jacob Kjome [mailto:[EMAIL PROTECTED]] NB> Sent: Monday, January 27, 2003 10:52 AM NB> To: Ant Users List NB> Subject: RE: How to get paths with forward slashes NB> If you read the docs on java.io.File, it can take the following formats: NB> C:\mydirectory\mysubdirectory\file.txt NB> C:\\mydirectory\\mysubdirectory\\file.txt NB> C:/mydirectory/mysubdirectory/file.txt NB> and the URL class taks the following formats: NB> file:///C:/mydirectory/mysubdirectory/file.txt NB> file:///C:\mydirectory\mysubdirectory\file.txt NB> you can even mix things up like this... NB> file:///C:\mydirectory\mysubdirectory/file.txt NB> The way I set up my file paths is: NB> <param name="File" value="${mycontext.log.home}/mylogfile.log"/> NB> I set a system property at runtime for said variable. The path that I NB> set NB> up looks like this on Windows: NB> C:\mydirectory\mysubdirectory NB> So, I'm not sure why Log4j would be choking on a path like this since it NB> works fine for me. Anyone else have an ideas? NB> Jake NB> At 06:48 AM 1/27/2003 -0500, you wrote: >>Well, here are the specific examples I am having trouble with: >> >>1) log4j's configuration file requires pathnames with either forward >>slashes or double back-slashes. If I use Ant to create this file with a >>path property, I get something like >> >> <param name="File" value="C:\MyProject\log\test.log"/> >> >>Log4j gets completely confused by this. >> >>2) The Axis Java2Wsdl task expects a URL in the form >> >> url="file:///C:/MyProject//MyProject.wsdl" >> >>I do not know how to give this URL to the Ant task even if I have a >>property that contains a regular path. >> >>Thanks. >>Naresh >> >>-----Original Message----- >>From: Jacob Kjome [mailto:[EMAIL PROTECTED]] >>Sent: Monday, January 27, 2003 12:00 AM >>To: Ant Users List >>Subject: Re: How to get paths with forward slashes >> >> >> >>Java programs will understand file: protocol URL's even if the slashes >>are a mix of forward and backslashes....at least that is my experience. >>So, I >>wouldn't worry much about this. >> >>Jake >> >>At 11:08 PM 1/26/2003 -0500, you wrote: >> >1) Is there a way to get paths in Ant with forward slashes even on >> >Windows platform? For example: >> > >> > <property name="app_home" location="."/> >> > >> >should somehow give c:/... instead of c:\... >> > >> >2) How can I get a file location as a URL (e.g. file:///C:/...) >> > >> >Naresh >> > >> >Naresh Bhatia >> >Sapient >> >One Memorial Drive, Cambridge, MA 02142 >> >Tel: 617-761-1771 Fax: 617-621-1300 >> >Email: [EMAIL PROTECTED] >> >>-- >>To unsubscribe, e-mail: NB> <mailto:[EMAIL PROTECTED]> >>For additional commands, e-mail: >><mailto:[EMAIL PROTECTED]> NB> -- NB> To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> NB> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- Best regards, Jacob mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> *Disclaimer* This mail and any accompanying documents contain confidential information intended for a specific individual and purpose. This information is private and protected by law. If you are not the intended recipient, you are hereby notified that any disclosure, copying or distribution, or the taking of any action based on the contents of this information, is strictly prohibited. Please let us know immediately if you have received this by mistake and appreciate if you could delete the original message. -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
