Re: WO and commons-logging with log4j
Trond Kandal <[email protected]>
| Newsgroups | gmane.comp.web.webobjects.devel |
|---|---|
| Message-ID | <[email protected]> |
時期精霊 wrote:
> 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?
>>
>
> 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
>
thank you *very* much!
this is a very elegant solution.
i have tried this and it works just fine! :)
thank you again.
trond.
--
Trond Kandal Organisasjonsavd. voice: +47 73597497
Integrasjonsgruppa NTNU mobile:+47 91897110
IT-seksjonen 7491 Trondheim fax: +47 73598200
http://www.itea.ntnu.no/integrasjon
This is Unix land.
In quiet nights you can hear M$-Windoze machines reboot.