yeah, I'm using ant but I dont like the fact that it is hard-coded.
 I think I'll use the properties file option, we have a properties file already I'll 
just add the log4j properties to that. I don't suppose you know how to load the 
properites file when it is in a JAR? because it says in the log4j FAQ "the log4j 
classes and the properties file are not within the scope of the same 
classloader.....So, if you're having problems, try loading the class or resource 
yourself. "
 what i've done already is:

 Properties p = new Properties();
 FileInputStream fis;
try
{
    fis = new FileInputStream("com.foo.bar.message.properties");
    p.load(fis);
}
catch (Throwable t)
{
    t.printStackTrace();
} 

PropertyConfigurator.configure(p);

 but its not picking up our file in the JAR

-----Original Message-----
From: Shapira, Yoav [mailto:[EMAIL PROTECTED]
Sent: Tuesday, August 12, 2003 2:42 PM
To: Log4J Users List
Subject: RE: Newbie how to place logfile under tomcat logs



Howdy,

> Thanks, thats a help but because of the setup of our application, I
cant
>use the first two options, and I'd rather not define another properties
>file just to store ${CATALINA_HOME}/logs/logs.txt. Is there any way I
can
>do it programatically? What are the other options?

No.  It would be against the spirit, if not the letter, or the servlet
specification for a servlet to be able to find out such details about
its container.  Even the approaches I showed before weren't that
portable.  This is like those perennial "how can I find out what port
the server is running on in my servlet's init() method?" (You can't with
certainty/portability).

Other options include adding a JNDI entry for your log file path into
tomcat's server.xml and then doing a JNDI lookup in your servlet's init
method, or mangling your log4j configuration together with tomcat's
commons-logging configuration.  The latter is just cruising for a
bruising, and the former is too container-specific (requires modifying
server.xml) for my preferences, so I didn't include them before.

Typically the Ant option is the one I like best, but I guess you don't
use Any to deploy/package your application?

Yoav Shapira



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]

Reply via email to