Howdy,
Create a properties file, called log4jconfiguration.prop, as follows:
log4j.appender.myFile = org.apache.log4j.FileAppender
log4j.appender.myFile.File = /var/tmp/myLogFile
log4j.appender.myFile.layout = org.apache.log4j.PatternLayout
log4j.appender.myFile.layout.ConversionPattern =%d %-5p: %m %n
log4j.rootLogger = DEBUG, myFile
For more details, see the introductory guide on jakarta.apache.org/log4j
and the JavaDoc for the PropertyConfigurator class.
Put this file under the /WEB-INF directory of your web application.
Then within a servlet context listener, or a servlet, or wherever you
want to configure log4j, do
PropertyConfigurator.configure(getServletContext().getResourceAsStream("
/WEB-INF/log4jconfiguration.prop");
in order to configure log4j. You're all set.
Yoav Shapira
Millennium ChemInformatics
>-----Original Message-----
>From: Luke Majewski [mailto:[EMAIL PROTECTED]
>Sent: Wednesday, March 12, 2003 1:00 PM
>To: [EMAIL PROTECTED]
>Subject: simple use of log4j with tdk
>
>Hello,
>
>I'm trying to use log4j with the sample turbine app - I'm not sure
where to
>post this question so I apologize if this is not the best place.
>I've looked at some samples in the manual as well as in the "scarab"
app
>that turbine uses for its examples. So in my code I do:
>
>static Logger logger = Logger.getLogger(my.class);
>
>and then I've tried:
>
>logger.debug("/n/n/nTEST/n/n/n");
>logger.info("/n/n/nTEST/n/n/n");
>
>-- I have no clue where it is sending this logging information, but it
is
>not writing it to a file or to console - is there an easy way to
specify a
>log file I want all my log4j logs going to? I know that I can create
an
>Appender to specify the output location, but I am not figuring out from
the
>javadoc how I would specify a file on my system. Also, I know I can
set a
>properties file and I have tried using the PropertyConfigurator to do
so as
>well and no luck... I am missing something major?
>
>thank you,
>
>Luke Majewski
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]