Rickard Öberg wrote:
I'm using log4j (wrapped by commons-logging) in an applet, and am having a hard time defeating the default behaviour to load log4j.xml and log4j.properties. This behaviour causes a bunch of unnecessary calls to the webserver, and I'd like to remove them.

Is there any way I can manually configure log4j and avoid the lookup of these files?

I just found the "Default Initialization Procedure" section in the manual, and tried it out, but it didn't work.


Here's the code I wrote:
static
{
System.out.println("CONFIGURE");
System.setProperty("log4j.defaultInitOverride", "true");
// Do log4j config manually in order to
// avoid unnecessary server calls
ConsoleAppender appender = new ConsoleAppender();
appender.setWriter(new PrintWriter(System.out));
appender.setThreshold(Priority.DEBUG);
PatternLayout layout = new PatternLayout();
layout.setConversionPattern("%-5p [%c{1}] %m%n");
appender.setLayout(layout);
Category.getRoot().addAppender(appender);
Category.getRoot().setLevel(Level.INFO);
System.out.println("CONFIGURED");
}
---
And the Java console output for the applet is:
CONFIGURE
Connecting http://localhost/editor/log4j.xml with no proxy
Connecting http://localhost/editor/log4j.xml with cookie "JSESSIONID=7A1E10E9E3F09D35F9E1771D25F7C34D"
Connecting http://localhost/editor/log4j.xml with no proxy
Connecting http://localhost/editor/log4j.xml with cookie "JSESSIONID=7A1E10E9E3F09D35F9E1771D25F7C34D"
Connecting http://localhost/editor/log4j.properties with no proxy
Connecting http://localhost/editor/log4j.properties with cookie "JSESSIONID=7A1E10E9E3F09D35F9E1771D25F7C34D"
Connecting http://localhost/editor/log4j.properties with no proxy
Connecting http://localhost/editor/log4j.properties with cookie "JSESSIONID=7A1E10E9E3F09D35F9E1771D25F7C34D"
CONFIGURED


In other words, skipping the default init procedure as outlined in the manual doesn't seem to work.

Any ideas?

/Rickard

--
Rickard Öberg
[EMAIL PROTECTED]
Senselogic

Got blog? I do. http://dreambean.com


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to