You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Ralph Goers (Jira)" <ji...@apache.org> on 2020/10/28 06:10:00 UTC

[jira] [Commented] (LOG4J2-2952) How can I do the same thing using log4j2 like what I did when using logback with janino?

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

Ralph Goers commented on LOG4J2-2952:
-------------------------------------

Log4j 2 doesn't provide a way to put conditional logic at arbitrary places in the configuration. Instead, various components support scripting, such as the ScriptAppenderSelector, the ScriptPatternSelector, and the ScriptFilter. We also have a ScriptComponentBuilder that lets you create the configuration using a scripting language, but that executes during configuration, not at runtime. If there are other places where you would find scripting support helpful please specify that.

> How can I do the same thing using log4j2 like what I did when using logback with janino?
> ----------------------------------------------------------------------------------------
>
>                 Key: LOG4J2-2952
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-2952
>             Project: Log4j 2
>          Issue Type: Question
>          Components: Appenders
>    Affects Versions: 2.13.3
>            Reporter: David Liu
>            Priority: Major
>
> I was trying to migrate from logback to log4j2 recently. With janino in logback, I could do a lot of things in the logback configuration xml file in a programmatic way, I thought it was very convenient. I've referred to the documentation of log4j2, but I could not find a proper way to do the same thing.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)