You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Piotr Karwasz (Jira)" <ji...@apache.org> on 2022/08/18 05:55:00 UTC
[jira] [Commented] (LOG4J2-3576) How to configure writing to multiple Appenders in log4j2?
[ https://issues.apache.org/jira/browse/LOG4J2-3576?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17581164#comment-17581164 ]
Piotr Karwasz commented on LOG4J2-3576:
---------------------------------------
Hi [~arjunballa],
I answered to your [question on StackOverflow|https://stackoverflow.com/q/73394020/11748454].
Personally I find the properties configuration format the most complex among all Log4j2 configuration formats. You should consider a switch to one of the other formats.
> How to configure writing to multiple Appenders in log4j2?
> ---------------------------------------------------------
>
> Key: LOG4J2-3576
> URL: https://issues.apache.org/jira/browse/LOG4J2-3576
> Project: Log4j 2
> Issue Type: Question
> Components: Appenders
> Affects Versions: 2.17.1
> Reporter: Mee
> Priority: Major
>
> h3. How to configure writing to multiple Appenders in log4j2?
> Prior to log4j2
> {code}
> log4j.appender.FILE=org.apache.log4j.RollingFileAppender
> log4j.appender.ELASTIC=com.my.ElasticSearchAppender
> log4j.rootLogger=FILE,ELASTIC # Works
> {code}
> log4j2
> {code}
> appender.elastic.type=Elasticsearch
> appender.elastic.name=elastic
> appender.rolling.type=RollingFile
> appender.rolling.name=rolling
> rootLogger.appenderRef.root.ref=rolling,elastic # does not work
> rootLogger.appenderRef.root.ref=rolling # works
> rootLogger.appenderRef.root.ref=elastic # works
> {code}
> I get the below error.
> {code}
> Log4J Updater ERROR Unable to locate appender "rolling,elastic" for logger config "root"
> {code}
> Am I doing something wrong?
--
This message was sent by Atlassian Jira
(v8.20.10#820010)