Skip to content

How to get access to appender methods with SLF4J? #2572

Answered by ppkarwasz
emelyanovkr asked this question in Q&A
Discussion options

You must be logged in to vote

You just need to use ListAppender.getListAppender() with the name of your appender:

/**
* Gets the named ListAppender if it has been registered.
*
* @param name the name of the ListAppender
* @return the named ListAppender or {@code null} if it does not exist
* @see org.apache.logging.log4j.core.test.junit.LoggerContextRule#getListAppender(String)
*/
public static ListAppender getListAppender(final String name) {
return ((ListAppender)
(LoggerContext.getContext(false)).getConfiguration().getApp…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@emelyanovkr
Comment options

Answer selected by emelyanovkr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants