|
Re: Tuning org.apache.commons.logging [message #485739 is a reply to message #485565] |
Mon, 14 September 2009 17:35 |
Peter Stibrany Messages: 37 Registered: July 2009 |
Member |
|
|
Hello Felix,
you need to configure Logger. Default logger writes all output to
console. To configure a logger, you can either specify system property
"org.apache.commons.logging.Log" with name of your Logger class (i.e.
-Dorg.apache.commons.logging.Log=com.my.Logger), or attach a fragment to
org.apache.commons.logging plugin with commons-logging.properties file,
as specified in Apache Commons Logging configuration.
Your configured Logger must implement org.apache.commons.logging.Log
interface [1]. It can do whatever you want, e.g. create a Status object
from log message and write it to eclipse log.
If you want to use apache commons logging with log4j, you need to create
a fragment for org.apache.commons.logging.Log plugin with configuration,
which depends on log4j. Another fragment (this time for log4j plugin)
will contain log4j.properties configuration. (Maybe this is too complex,
and somebody will suggest something simpler, but it should work).
Peter Stibrany
Foglyn - FogBugz in Eclipse
www.foglyn.com
[1]
http://commons.apache.org/logging/apidocs/org/apache/commons /logging/Log.html
Felix Dorner wrote:
> Hi,
>
> I was looking for a logging bundle, found apache commons already
> available as a bundle. So I just used
>
> Log log = LogFactory.getLog(My.class);
> log.info(...);
>
> and hoped it would "just work". And so it does, I get output on the
> equinox console.
>
> How can I configure that output, "appenders", etc? Would I just look at
> the apache manual pages? Anything special when this is used in an OSGi
> environment?
>
> Cheers,
> Felix
>
|
|
|
Powered by
FUDForum. Page generated in 0.02923 seconds