Skip to main content



      Home
Home » Eclipse Projects » Equinox » Tuning org.apache.commons.logging
Tuning org.apache.commons.logging [message #485565] Sun, 13 September 2009 14:14 Go to next message
Eclipse UserFriend
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
Re: Tuning org.apache.commons.logging [message #485739 is a reply to message #485565] Mon, 14 September 2009 13:35 Go to previous message
Eclipse UserFriend
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
>
Previous Topic:Equinox launcher does not start bundles
Next Topic:P2: Language Packs from Babel
Goto Forum:
  


Current Time: Tue Jul 15 13:55:21 EDT 2025

Powered by FUDForum. Page generated in 2.64659 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top