logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apostolis Giannakidis <ap.giannaki...@gmail.com>
Subject Getter method for retrieving the attributes of an appender from the LoggerContext
Date Tue, 26 Jan 2016 18:58:27 GMT
Hello team,

I have created a logger with an appender using the ConfigurationBuilder and
the AppenderComponentBuilder.

Let's say that this is how I create my appender:

AppenderComponentBuilder appenderBuilder =
                builder.newAppender( "syslogAppender", "Syslog" )
                .addAttribute( "protocol", "TCP" )
                .addAttribute( "host", "localhost" )
                .addAttribute( "port", 514 )
                .addAttribute( "facility", "LOCAL2" )
                .addAttribute( "immediateFlush", true )
                .addAttribute( "newLine", true );

Then, after I finish creating the builder I use the
Configurator.initialize( builder.build() ) to get the LoggerContext.

Is there any way I can access the attributes of the appender through the

For example something like this:

LoggerContext ctx = Configurator.initialize( builder.build() );

String hostname =

Thank you all very much for your help.


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message