Howdy, Cool, thanks for posting your final solution! ;) Yoav Shapira Millennium ChemInformatics
>-----Original Message----- >From: Larry Young [mailto:[EMAIL PROTECTED] >Sent: Wednesday, August 27, 2003 3:56 PM >To: Log4J Users List >Subject: RE: Location of log files > >Yaov, > > Arrrrgg .... why didn't I check the book before posting >that!! On page 101 of Ceki's book, the File option has a full description >associated with it, including the note about having to escape the '\' on >the windoze platform, and also about being able to simply use the '/' >instead. Having said that, it might be useful to have that note in the >javadocs too. :) > > So basically all I need to do is simply convert my CATALINA_HOME >value to use '/'. Sorry for wasting everyone's time. > > BTW, I did look at the fixCRLF task, but that operates on the >entire file, and I wasn't sure that there wouldn't be any '\' characters >somewhere else in my log4j.xml file. So, the final solution that I came up >with is as follows, and this should work on both Windoze & *nix. > > <property name="installdir" >value="${env.CATALINA_HOME}/webapps/MYAPP"/> > > <target ...> > .... > <pathconvert dirsep="/" property="logfile"> > <path >path=${installdir}/WEB-INF/${ant.project.name}.log/> > </pathconvert> > <filter token="LOGFILE" value="${logfile}/> > <copy todir=${build}/WEB_INF/classes" > file="${basedir}/config/log4j.xml" > filtering="true"/> > .... > </target> > > Thanks again for all your help! > >--- regards --- >Larry > >At 01:54 PM 8/27/03 -0400, you wrote: > >>Howdy, >>Ant can handle either way, forward or back, as long as it's consistent. >>The problem arises when a single string uses mixed slashes. Ant's >>FixCRLF task works in this area and might be useful here. >> >>Yoav Shapira >>Millennium ChemInformatics >> >> >> >-----Original Message----- >> >From: Larry Young [mailto:[EMAIL PROTECTED] >> >Sent: Wednesday, August 27, 2003 1:57 PM >> >To: Log4J Users List >> >Subject: RE: Location of log files >> > >> >Yoav, >> > >> > Thanks for the suggestion, but that doesn't work either. >> > >> > So now I have: >> > <property name="installdir" >> >value="${env.CATALINA_HOME}/webapps/MYAPP"/> >> > >> > <target ...> >> > <filter token="INSTALLDIR" >> >value="${installdir>/WEB_INF/> >> > <copy todir=${build}/WEB_INF/classes" >> > file="${basedir}/config/log4j.xml" >> > filtering="true"/> >> > </target> >> > >> > And the generated log4j.xml file has the same mixed / & \ >>values. >> > >> > Beyond that, I tried to manually change all the '/' to '\' in >>the >> >generated log4j.xml file and when I ran it, it put the file under >> >tomcat/bin and its name was the concatenation of all the path elements. >>I >> >then tried to "escape" the backslash and that worked fine! This would >> >sound like a problem with the xml parser log4j is using when it is >>parsing >> >the "value" param and handing it to log4j. >> > >> > Oddly enough, when I changed all the backslash's to >> >forward-slash's, that worked too. I thought on a Windoze box, Java >>used >> >the system-dependent filenaming conventions when creating a >> >FileOutputStream (which is all that log4j does with the filename)? >> > >> > So are you doing this currently on a windoze or *nix box? I >>can >> >see how it would work in a non-M$ environment. Thoughts? >> > >> >--- regards --- >> >Larry >> > >> > >> >At 12:39 PM 8/27/03 -0400, you wrote: >> > >> >>Howsdy, >> >>Try >> >><filter token="token" value="value" /> >> >>outside a filterset. (i.e. no filterset at all, just the above line >> >>above the <copy> task. >> >> >> >>Yoav Shapira >> >>Millennium ChemInformatics >> >> >> >> >> >> >-----Original Message----- >> >> >From: Larry Young [mailto:[EMAIL PROTECTED] >> >> >Sent: Wednesday, August 27, 2003 11:36 AM >> >> >To: Log4J Users List >> >> >Subject: RE: Location of log files >> >> > >> >> >Hello, >> >> > >> >> > This is a question about a post from several weeks ago. I >> >>wasn't >> >> >ready to try it at the time, but I saved it because I knew I'd need >>it >> >> >later on ... :) >> >> > >> >> > When I tried to use "filtering" as described in the >>original >> >>post >> >> >(actually, I created a "filterset" inside the copy tag), it works >>fine >> >> >except that on Windows 2K it contains back-slashes(\) from my >> >> >$CATALINA_HOME env variable and forward-slashes(/) from the subpath >> >>info >> >> >inside of Ant. Then, when log4j gets it, the backslashes are >> >>effectively >> >> >ignored (probably interpreted as "escaping" the next character) so >> >>log4j >> >> >complains that no such directory exists. >> >> > >> >> > Is there a way to get log4j to accept either path-separator >> >> >character, or alternately is anyone aware of an Ant function to >>force >> >> >"filtering" to use the platform-dependent path separator when >>replacing >> >> >text ?? >> >> > >> >> >My Ant build.xml looks basically like this: >> >> > >> >> > <property name="installdir" >> >> >value="${env.CATALINA_HOME}/webapps/MYAPP"/> >> >> > >> >> > <target ...> >> >> > <copy todir=${build}/WEB_INF/classes" >> >> > file="${basedir}/config/log4j.xml"> >> >> > <filterset> >> >> > <filter type="INSTALLDIR" >>value="${installdir>/WEB_INF/> >> >> > </filterset> >> >> > </copy> >> >> > </target> >> >> > >> >> >And my log4j.xml looks roughly like this: >> >> > >> >> > <appender name="XYZ" >> >> > class="... RollingFileApppender"> >> >> > <param name="file" value="@INSTALLDIR@/myapp.log/> >> >> > ..... >> >> > </appender> >> >> > >> >> >In the destination log4j.xml file, the value for the appender's >>"file" >> >> >param is "C:\Java\tomcat/webapps/MYAPP/WEB_INF/myapp.log". Any >> >>thoughts >> >> >??? >> >> > >> >> >--- regards --- >> >> >Larry >> >> > >> >> > >> > >> >-------------------------- >> >Larry Young >> >The Dalmatian Group >> >www.dalmatian.com >> > >> > >> > >> >--------------------------------------------------------------------- >> >To unsubscribe, e-mail: [EMAIL PROTECTED] >> >For additional commands, e-mail: [EMAIL PROTECTED] >> >> >> >> >>This e-mail, including any attachments, is a confidential business >>communication, and may contain information that is confidential, >>proprietary and/or privileged. This e-mail is intended only for the >>individual(s) to whom it is addressed, and may not be saved, copied, >>printed, disclosed or used by anyone else. If you are not the(an) >>intended recipient, please immediately delete this e-mail from your >>computer system and notify the sender. Thank you. >> >> >>--------------------------------------------------------------------- >>To unsubscribe, e-mail: [EMAIL PROTECTED] >>For additional commands, e-mail: [EMAIL PROTECTED] > >-------------------------- >Larry Young >The Dalmatian Group >www.dalmatian.com > > > >--------------------------------------------------------------------- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]