Hi,

Thank you for your replies. Sure, I can look at the StatusLogger output but
that's not what I need to do. I need to check programmatically if a logger
with name X.Y.Z has been configured using the configuration file I
provided. Like I said, I tried instantiating LoggerContexts etc. none of it
worked.

I feel this can't be so hard to do but I don't even know how to get hold of
the "default" LoggerContext which is used when the application is fired up.

David


On Thu, Oct 24, 2013 at 2:19 PM, Remko Popma <[email protected]> wrote:

> You can also check with JConsole (see the JMX docs).
>
> Sent from my iPhone
>
> > On 2013/10/24, at 21:06, <[email protected]> wrote:
> >
> > Hi,
> >
> > Which configuration file are you using?
> > If you're using XML try this:
> > <Configuration
> >    status="debug"...
> >
> > You should then see something along the lines of
> >
> > 2013-10-24 14:03:09,332 DEBUG Calling createLogger on class
> org.apache.logging.log4j.core.config.LoggerConfig$RootLogger for element
> Root with params(additivity="null", level="info", includeLocation="null",
> AppenderRef={STDOUT, FLOW, EXCEPTION}, Properties={},
> Configuration(HereWillBeYourConfigurationName), null)
> >
> > Does it print the name of the logger you are looking for in your
> application?
> >
> >
> > /Alex
> >
> >
> >
> > -----Ursprüngliche Nachricht-----
> > Von: David KOCH [mailto:[email protected]]
> > Gesendet: Donnerstag, 24. Oktober 2013 12:04
> > An: [email protected]
> > Betreff: How to get loggers configured in log4j2.xml
> >
> > Hello,
> >
> > How can I check inside the application if a particular logger has been
> configured in the log4j configuration file?
> >
> > LogManager.getContext(...).hasLogger(<name>) always returns "false" even
> though I know the logger has been configured.
> >
> > Thank you,
> >
> > /David
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [email protected]
> > For additional commands, e-mail: [email protected]
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

Reply via email to