Re: WO and commons-logging with log4j

時期精霊 <[email protected]>
Newsgroups gmane.comp.web.webobjects.devel
Message-ID <[email protected]>
Trond Kandal wrote:
> Hi!
> 
> when developing wo-apps we want to use commons-logging and log4j.
> wo is bundled with both commons-logging.jar and log4j-1.2.4.jar in
> the /Library/WebObjects/Extensions-directory and this seems to work.
> *but* when i am using commons-logging in my app it finds the log4j
> alright but uses the log4j.properties which is inside axis.jar which
> is resides in the /Library/WebObjects/Extensions-directory.
> 
> in my case i want to use a customized log4j.properties which makes
> my apps to log to syslog. and use syslog.conf to choose which
> files to write the log-information.
> i have tried to set the property "log4j.configuration" to point
> to the customized file but that does not work either.
> 
> has anyone tried the same and found how to do this?
> 
> thanks!
> 
> trond.

We use this for logging:

	PropertyConfigurator.
			configure(WOApplication.application().
					  resourceManager().
					  pathURLForResourceNamed("log4j.properties", "app", null));
		
		
		// Setting up logging
		NSLog.Log4JLogger debug =
			new NSLog.Log4JLogger(Logger.getLogger("debug"),
								  NSLog.DebugLevelDetailed);
		
		NSLog.Log4JLogger err =
			new NSLog.Log4JLogger(Logger.getLogger("err"),
								  NSLog.DebugLevelCritical);
		
		NSLog.Log4JLogger out =
			new NSLog.Log4JLogger(Logger.getLogger("out"),
								  NSLog.DebugLevelInformational);
		
		NSLog.setErr(err);
		NSLog.setOut(out);
		NSLog.setDebug(debug);
		
         NSLog.out.appendln("Logger configured"); // we use NSLog, which 
is redirected to log4j


Hope this help

Regards

-- 
Kuon
CEO - Goyman.com SA
http://www.goyman.com/

"Computers should not stop working when the users' brain do."

_______________________________________________
WebObjects-dev mailing list
[email protected]
http://www.omnigroup.com/mailman/listinfo/webobjects-dev
smime.p7s (application/x-pkcs7-signature, 3.1 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.