try something like this:

<param name="File" value="file:/<mydrive>/<mydir>/oemsys.log"/>

where you replace "<mydrive>" and "<mydir>".

-Mark

-----Original Message-----
From: pradeep [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 17, 2001 6:55 AM
To: [EMAIL PROTECTED]
Subject: How to log o/p to a specified file location


Hi Guys,
My problem is very simple.I need to direct my log file output to a location 
i specify.
This is what i use
My xml config file is as shown below:My java code as shown where strXmlFile 
is the file location of xml file
Im using the jbuilder environment to run .The output log is going to the 
working directory of jbuilder
Is there a way to change the o/p file location using log4j xml config file 
or api calls
ps let me know if any
thx
pradeep.

Java code
strXmlfile=ResourceManager.getResource(LOG_FILE_LOCATION, null);
log4j=Category.getInstance(OemsSystemLog.class.getName());
DOMConfigurator.configure(strXmlfile);

XMl file
<?xml version="1.0" encoding="UTF-8"?>
<!-- This file is the configuartion files for all logging activities -->
<!-- This file prints int a file called oemssys.log-->
<!-- To print the o/p to console comment the section 'FILE COMMENTS START 
HERE'
AND uncomment 'CONSOLE'.The default is file o/p.-->
<!-- SEARCH FOR 'DEBUG' and follow the instruction to disable log message-->
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/";>
<!--FILE COMMENTS START HERE-->
<appender name="systemlog" class="org.apache.log4j.FileAppender">
<param name="File" value="oemsys.log"/>-
<!--FILE END COMMENTS HERE-->
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{dd MMM yyyy HH:mm:ss} | %C{1} | 
%-5p | - %m\n"/>
</layout>
</appender>
<category name="com.oems.util.OemsSystemLog">
<!--DEBUG change the value to fatal if u need to disable log messages -->
<priority value="info"/>
</category>
<root>
<priority value="info"/>
<appender-ref ref="systemlog"/>
</root>
</log4j:configuration>
thx




---------------------------------------------------------------------
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