On Tue, 27 Jan 2009 10:23:14 -0500
Ravi <rav...@cox.net> wrote:
Hi: How do I setup the filename to which to send the logs within my code?
my log4j.xml has the following. I guess I have to send the File attribute
from my code. Can't seem to figure out how to change it using the
BasicConfigurator.
For an XML config file, you need to use DOMConfigurator and for a Properties
file you need to use a PropertiesConfigurator. BasicConfigurator is just
that; Basic. It sets up pre-defined defaults for Log4j logging and only
outputs to the console. Config files are ignored.
In any case, you generally don't need to use a configurator at all. Just
place log4j.xml or log4j.properties in the classpath (in the default, or no,
package) and let Log4j autoconfigure itself.
You really should read up on Log4j (see resources on the Log4j project page).
We welcome questions here, but prefer that you do at least some minimum
research before doing so. If after doing your own research, you still can't
fine the answer, then go ahead and post, but not before that.
Jake
=============
<appender name="FileLog" class="org.apache.log4j.RollingFileAppender">
<param name="File" value="./logs/mylogs.logs" />
<param name="MaxFileSize" value="100KB"/>
<!-- Keep one backup file -->
<param name="MaxBackupIndex" value="1"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern"
value="%d %-5p [%t] %C (%F:%L) - %m%n"/>
</layout>
</appender>
==============
Thanks
--
Thank you,
RaVi
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org