Re: WO and commons-logging with log4j
| Newsgroups | gmane.comp.web.webobjects.devel |
|---|---|
| Message-ID | <OF07BD1ABC.B67092CF-ON87257129.0076393C-87257129.0076A8DE@nd.convergys.com> |
[email protected] wrote on 03/05/2006 05:49:37 AM: > 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 For our Xcode-based builds, we do something similar, except we use log4j straight w/o any of the NSLog stuff. For our strictly Eclipse/WOLips projects, we just add our log4j.properties to the classes.include file and WOLips puts it on the classpath for us. However, we just recently started integrating project Wonder, and we're now using their log4j setup (which includes a component where you can dynamically change logging levels at runtime). Logan _______________________________________________ WebObjects-dev mailing list [email protected] http://www.omnigroup.com/mailman/listinfo/webobjects-dev