You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Kevin Lohmann <ke...@d-velop.de> on 2008/10/09 09:16:45 UTC

Using log4J

Hi *,

in our application we have our own logging-system: some statements get
point out at the console, other statements will be written into a
database. 

A few bundles (3rd party: jpa, jboss, etc) use log4j. To cover those
log4j-statements we have an Appender, which maps log4j-LoggingEvents to
our logging-system. Thats the theory.

The reality asks: How can you do this?
The first approach was an extension-bundle that contained the
log4j.properties-file. While using log4j-appenders everything worked
fine, because those bundles, that use log4j, have import-declarations on
log4j. When we tried to use our own appenders, those bundles would need
an import on our appender-package (the extension-bundle must not have
import-declaration). But to hack these declarations into the bundles is
not a good idea.

So we tried fragment-bundles. But a fragment can just only have one
host...also, not good.

The third (and for now the last) idea was to create a bundle, that
configures log4j programmatically (no log4j.properties file). And heyja,
there you go. But for logger "org.jboss.messaging.util.Version" was no
appender found. Thats curious, because we have configured a RootLogger,
that should log everything, shouldn't it? At least jpa and mortybay
don't complain about having no appender. When we set a specific logger
to "org.jboss.messaging.util.Version" nothing changes.

So did anyone saw those problems to and solved it? Has anyone another
approach that will be solving this problem?

Thanks for any reply,
 Kevin

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


AW: Using log4J

Posted by Kevin Lohmann <ke...@d-velop.de>.
Hi Barend,

> W.B. Garvelink wrote
> While I never ran into the problem you describe, it sounds as if the
> jboss lib is not reaching the same LoggerRepository singleton as the
> others. You may have already checked this, but make sure that the
> jboss lib uses the same log4j bundle as the other libs?
that was the crux. A big thanks, that solve the problem!

Cheers,
 Kevin

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Using log4J

Posted by "W.B. Garvelink" <ba...@gmail.com>.
The application I'm working on uses log4j directly. Like you, we had
to configure programmatically. We wired ManagedService and
PropertyConfigurator together.

While I never ran into the problem you describe, it sounds as if the
jboss lib is not reaching the same LoggerRepository singleton as the
others. You may have already checked this, but make sure that the
jboss lib uses the same log4j bundle as the other libs? Also, use
-Dlog4j.debug=true if you haven't yet, that might give some clues as
well.

HTH,
Barend


On 10/9/08, Kevin Lohmann <ke...@d-velop.de> wrote:
>
> Hi *,
>
> in our application we have our own logging-system: some statements get
> point out at the console, other statements will be written into a
> database.
>
> A few bundles (3rd party: jpa, jboss, etc) use log4j. To cover those
> log4j-statements we have an Appender, which maps log4j-LoggingEvents to
> our logging-system. Thats the theory.
>
> The reality asks: How can you do this?
> The first approach was an extension-bundle that contained the
> log4j.properties-file. While using log4j-appenders everything worked
> fine, because those bundles, that use log4j, have import-declarations on
> log4j. When we tried to use our own appenders, those bundles would need
> an import on our appender-package (the extension-bundle must not have
> import-declaration). But to hack these declarations into the bundles is
> not a good idea.
>
> So we tried fragment-bundles. But a fragment can just only have one
> host...also, not good.
>
> The third (and for now the last) idea was to create a bundle, that
> configures log4j programmatically (no log4j.properties file). And heyja,
> there you go. But for logger "org.jboss.messaging.util.Version" was no
> appender found. Thats curious, because we have configured a RootLogger,
> that should log everything, shouldn't it? At least jpa and mortybay
> don't complain about having no appender. When we set a specific logger
> to "org.jboss.messaging.util.Version" nothing changes.
>
> So did anyone saw those problems to and solved it? Has anyone another
> approach that will be solving this problem?
>
> Thanks for any reply,
>  Kevin
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org