You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "a11enhuang (via GitHub)" <gi...@apache.org> on 2023/03/17 14:28:06 UTC

[I] How to configure a ContextDataProvider for a specified Appender? (logging-log4j2)

a11enhuang opened a new issue, #1377:
URL: https://github.com/apache/logging-log4j2/issues/1377

   I have a custom Appender and want to configure a specific ContextDataProvider for this Appender, how can I do it? After reading the documentation and code, I found that ContextDataProvider is loaded through SPI, which means that once I load it through SPI, it will work for all Appenders, but I only want a certain Appender to take effect.
   I tried specifying a ContextDataProvider in the config file:
   ```xml
   <LogCollector name="MyAppender">
       <ContextDataProvider class="com.xxx.MyContextDataProvider"/>
       <PatternLayout pattern="${CONSOLE_LOG_PATTERN}" charset="UTF-8"/>
   </LogCollector>
   ```
   Then I got an error:
   `ERROR StatusConsoleListener MyAppender contains an invalid element or attribute "ContextDataProvider"`
   what should I do?
   The version of log4j I am using is `v2.20`


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] How to configure a ContextDataProvider for a specified Appender? (logging-log4j2)

Posted by "ppkarwasz (via GitHub)" <gi...@apache.org>.
ppkarwasz commented on issue #1377:
URL: https://github.com/apache/logging-log4j2/issues/1377#issuecomment-1473947221

   The [question template](https://github.com/apache/logging-log4j2/blob/2.x/.github/ISSUE_TEMPLATE/question.md) states:
   
   > As clearly indicated in [the Log4j support page](https://logging.apache.org/log4j/2.x/support.html#issues), **please use mailing lists for questions!**
   > Issues asking questions will be removed, and you will be asked to post questions to the mailing lists instead.
   
   So please post on the [log4j-dev@logging.apache.org](https://logging.apache.org/log4j/2.x/support.html) mailing list or ask a question on StackOverlow using the [`log4j2` tag](https://stackoverflow.com/questions/tagged/log4j2)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] How to configure a ContextDataProvider for a specified Appender? (logging-log4j2)

Posted by "ppkarwasz (via GitHub)" <gi...@apache.org>.
ppkarwasz closed issue #1377: How to configure a ContextDataProvider for a specified Appender?
URL: https://github.com/apache/logging-log4j2/issues/1377


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org