You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by "Huber, Christian" <Ch...@spls.siemens.com> on 2001/12/19 03:44:12 UTC
File appender output
Hi,
I have a problem with the output. My property file creates the destination
file, but I don't get any inserts there. Maybe you can help me...
Here is the property file:
log4j.category.=DEBUG, append1
log4j.appender.append1=org.apache.log4j.FileAppender
log4j.appender.append1.File=c:/temp/logs11.log
log4j.appender.append1.layout=org.apache.log4j.PatternLayout
log4j.appender.append1.layout.ConversionPattern=("%-5p %d [%t]: %m %n")
and here is my java code:
public class Property extends Controller {
static public Properties props = new Properties();
// Define URL
protected static String sourceURL = "jdbc:weblogic:mssqlserver4";
// Define the driver
protected static String driverName = "weblogic.jdbc.mssqlserver4.Driver";
static Category cat = Category.getInstance("POextract");
static Category fil = Category.getInstance("append1");
PatternLayout layout = new PatternLayout("%-5p %d [%t]: %m %n");
public Property() { //Logger() {
ConsoleAppender conApp = new ConsoleAppender();
WriterAppender filApp = new WriterAppender();
try {
FileInputStream fstream = new FileInputStream("c:/Program
Files/jbuilder5/lib/temp/fil.txt");
Properties append = new Properties();
append.load(fstream);
PropertyConfigurator.configure(append);
fil.debug("in try block");
}
catch (Exception e)
{
System.err.println("Error loading " + e.toString());
e.printStackTrace();
}
conApp.setLayout(layout);
conApp.activateOptions();
BasicConfigurator.configure(conApp);
cat.addAppender(conApp);
cat.setPriority(Priority.DEBUG);
}
static void GetProperty() {
Property GetProp = new Property();
props.put("user", "sa");
props.put("password", "eneti");
props.put("server", "spls0002:1433");
cat.debug("Properties ready");
fil.debug("Properties ready");
}
public void doIt(String s1, String s2, String s3, String s4) {
cat.info(s1);
cat.debug(s2);
cat.error(s3);
cat.warn(s4);
}
}
Thanks for your help!!
Merry X-MAS and a Happy New Year!!!
Chris
Christian Huber
Siemens Procurement and Logistics Services, LLC
c2p Operations - click2procureSM
4900 Old Ironsides Drive, Bldg.1
Mailstop 100
Santa Clara, CA 95054, USA
Tel.: (408) 764-9223 Fax: (408) 764-9210
E-mail: christian.huber@spls.siemens.com
Siemens e-Procurement Solution/Buy-Side Marketplace:
<http://www.click2procure.com>
Be part of Siemens Suppliers? Suppliers Registration:
<http://click4suppliers.siemens.com>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>