logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ralph Goers (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LOG4J2-468) Dynamically (programmatically) add logger in Log4j2
Date Wed, 18 Dec 2013 16:24:10 GMT

    [ https://issues.apache.org/jira/browse/LOG4J2-468?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13851881#comment-13851881

Ralph Goers commented on LOG4J2-468:

You would do something like:
LoggerContext ctx = (LoggerContext) LogManager.getContext(false);
Configuration config = ctx.getConfiguration();
config.addLogger("com.mycorp.myproduct.mypackage", Level.INFO, (Filter) null);

Note that anything added programmatically will be lost if a reconfiguration occurs.  In that
case you are better off extending XMLConfiguration to add your own customizations.

> Dynamically (programmatically) add logger in Log4j2
> ---------------------------------------------------
>                 Key: LOG4J2-468
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-468
>             Project: Log4j 2
>          Issue Type: New Feature
>            Reporter: Dean Anderson
> Please add the ability for someone to dynamically add a new Logger programmatically.
> Thank you.

This message was sent by Atlassian JIRA

To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org

View raw message