Thanks, I think I know where my problem is. Must be a bad day for me. I just realized I have been assuming that the './' and '/' being the same thing.
And you can imagine my surprise when I saw where things went when I invoke the server within eclipse. I always thought the path is relative to whatever docBase is defined in server.xml under $TOMCAT_HOME/conf. Obviously it isn't... -----Original Message----- From: Shapira, Yoav [mailto:[EMAIL PROTECTED] Sent: Thursday, December 11, 2003 1:49 PM To: Log4J Users List Subject: RE: Log output path problem Howdy, You're asking a number of questions in this one post. >This is weird. I had it working two hours ago with /web/WEB- >INF/logs/debug.log >as my output path. Now it's not working!!! I have to use the absolute path The above is an absolute path. It should work (provided you have permission to write to this directory). >make logging working for now. Also it seems that if I use the relative >path /web/debug.log or just debug.log, things worke fine, but that's not >where I want it to go to. I didn't say it wouldn't work: I said it would place the log file in a path relative to the current working directory of the server. As you've observed, this is not the desired behavior. >Could the same server invoke things differently? Man, what's the deal with Depends on the server. More likely, you started the server from different directories. >setFile() anyway? Why it cannot create the path dirs if the path doesn't >exist? That's beyond the purview of log4j. The user is responsible for configuration including the creation of directories. It is both common and recommended to run Java with a security manager with specific write permissions to the log file only, not anywhere else. Yoav Shapira > > >-----Original Message----- >From: Shapira, Yoav [mailto:[EMAIL PROTECTED] >Sent: Thursday, December 11, 2003 10:44 AM >To: Log4J Users List >Subject: RE: Log output path problem > > > >Howdy, >You need to specify the absolute path or use an environment variable, >such as one set to the server's home. Your current specification is >relative to the current working directory of the server, which varies >depending on how the server is invoked. > >Yoav Shapira >Millennium ChemInformatics > > >>-----Original Message----- >>From: Yansheng Lin [mailto:[EMAIL PROTECTED] >>Sent: Thursday, December 11, 2003 12:40 PM >>To: [EMAIL PROTECTED] >>Subject: Log output path problem >> >> >>Hi, I want my log output to go to /WEB-INF/logs/ as specified in my >>log4j.properties >> >>---------------------------------------------------------------------- - >- >>log4j.rootLogger=debug, stdout, ROOT_APPENDER >>log4j.appender.ROOT_APPENDER=org.apache.log4j.DailyRollingFileAppender >>log4j.appender.ROOT_APPENDER.DatePattern='.'yyyy-MM-dd >>log4j.appender.ROOT_APPENDER.File=WEB-INF/logs/debug.log >>---------------------------------------------------------------------- - >- >> >>But I am getting the following error when I run a test program: >> >>---------------------------------------------------------------------- - >- >>log4j:ERROR setFile(null,true) call failed. >>java.io.FileNotFoundException: WEB-INF\logs\debug.log (The system >cannot >>find >>the path specified) >> at java.io.FileOutputStream.openAppend(Native Method) >> at java.io.FileOutputStream.<init>(FileOutputStream.java:174) >> at java.io.FileOutputStream.<init>(FileOutputStream.java:102) >> at org.apache.log4j.FileAppender.setFile(FileAppender.java:272) >> at >>org.apache.log4j.FileAppender.activateOptions(FileAppender.java:151) >> at >>org.apache.log4j.DailyRollingFileAppender.activateOptions(DailyRolling F >ileA >>ppend >>er.java:206) >> at >>org.apache.log4j.config.PropertySetter.activate(PropertySetter.java:24 7 >) >> at >>org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.ja v >a:12 >>3) >> at >>org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.ja v >a:87 >>) >> at >>org.apache.log4j.PropertyConfigurator.parseAppender(PropertyConfigurat o >r.ja >>va:64 >>5) >> at >>org.apache.log4j.PropertyConfigurator.parseCategory(PropertyConfigurat o >r.ja >>va:60 >>3) >> at >>org.apache.log4j.PropertyConfigurator.configureRootCategory(PropertyCo n >figu >>rator >>.java:500) >> at >>org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator . >java >>:406) >> at >>org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator . >java >>:432) >> at >>org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionConv e >rter >>.java >>:460) >> at org.apache.log4j.LogManager.<clinit>(LogManager.java:113) >> at org.apache.log4j.Logger.getLogger(Logger.java:94) >> at Log4JTest.<clinit>(Log4JTest.java:21) >>log4j:ERROR Either File or DatePattern options are not set for appender >>[ROOT_APPENDER]. >> INFO [main] (Log4JTest.java:29) - Entering application. >>0 [main] INFO Log4JTest - Entering application. >>program executing >> INFO [main] (Log4JTest.java:31) - Exiting application. >>0 [main] INFO Log4JTest - Exiting application. >>---------------------------------------------------------------------- - >- >> >>The test program is: >> >>------------------------------------------------------------------- >>import org.apache.log4j.Logger; >>import org.apache.log4j.BasicConfigurator; >> >>public class Log4JTest >>{ >> >> // Define a static logger variable so that it references the >> // Logger instance named "Log4JTest". >> static Logger logger = Logger.getLogger(Log4JTest.class); >> >> public static void main(String[] args) >> { >> >> // Set up a simple configuration that logs on the console. >> BasicConfigurator.configure(); >> >> logger.info("Entering application."); >> System.out.println("program executing"); >> logger.info("Exiting application."); >> } >>} >>------------------------------------------------------------------- >> >> >>PS. I don't get the above error if I specify the output path to be: >> log4j.appender.ROOT_APPENDER.File=debug.log >> Oh, I aslo tried: >> log4j.appender.ROOT_APPENDER.File=/WEB-INF/logs/debug.log >> But got same error. >> >>Thanks in advance! >> >>-Yan >> >> >>--------------------------------------------------------------------- >>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] > > >--------------------------------------------------------------------- >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] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]