@@ -93,21 +93,6 @@ def installed_plugins
9393
9494
9595def setup_logger_spy
96- java_import org . apache . logging . log4j . core . config . builder . api . ConfigurationBuilderFactory
97- java_import org . apache . logging . log4j . Level
98- config_builder = ConfigurationBuilderFactory . newConfigurationBuilder
99- configure_log_spy = config_builder
100- . add (
101- config_builder
102- . newAppender ( "LOG_SPY" , "List" )
103- . add ( config_builder . newLayout ( "PatternLayout" ) . addAttribute ( "pattern" , "%-5p [%t]: %m%n" ) )
104- )
105- . add (
106- config_builder
107- . newRootLogger ( Level ::INFO )
108- . add ( config_builder . newAppenderRef ( "LOG_SPY" ) ) )
109- . build ( false )
110-
11196 java_import org . apache . logging . log4j . core . config . Configurator
11297 java_import org . apache . logging . log4j . core . config . Configuration
11398
@@ -121,7 +106,25 @@ def setup_logger_spy
121106 expect ( log_ctx ) . not_to be nil
122107 log_ctx . reconfigure ( configure_log_spy ) # force the programmatic configuration, without this it's not used
123108
124- return log_ctx
109+ log_ctx
110+ end
111+
112+ def configure_log_spy
113+ java_import org . apache . logging . log4j . core . config . builder . api . ConfigurationBuilderFactory
114+ java_import org . apache . logging . log4j . Level
115+ config_builder = ConfigurationBuilderFactory . newConfigurationBuilder
116+ configuration = config_builder
117+ . add (
118+ config_builder
119+ . newAppender ( "LOG_SPY" , "List" )
120+ . add ( config_builder . newLayout ( "PatternLayout" ) . addAttribute ( "pattern" , "%-5p [%t]: %m%n" ) )
121+ )
122+ . add (
123+ config_builder
124+ . newRootLogger ( Level ::INFO )
125+ . add ( config_builder . newAppenderRef ( "LOG_SPY" ) ) )
126+ . build ( false )
127+ configuration
125128end
126129
127130def retrieve_logger_spy ( log_ctx )
0 commit comments