Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » Tuning org.apache.commons.logging
Tuning org.apache.commons.logging [message #485565] Sun, 13 September 2009 18:14 Go to next message
Felix Dorner is currently offline Felix DornerFriend
Messages: 676
Registered: July 2009
Senior Member
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 17:35 Go to previous message
Peter Stibrany is currently offline Peter StibranyFriend
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
>
Previous Topic:Equinox launcher does not start bundles
Next Topic:P2: Language Packs from Babel
Goto Forum:
  


Current Time: Wed Apr 24 23:55:24 GMT 2024

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

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

Back to the top