suger-m commented on issue #216:
URL: https://github.com/apache/bifromq/issues/216#issuecomment-3708236574

   try  
   ```java
   public class SimpleAuthPlugin extends BifroMQPlugin<SimpleAuthPluginContext> 
{
       private static final Logger log = 
LoggerFactory.getLogger(SimpleAuthPlugin.class);
       private static final String LOG4J2_CONFIG_FILE = "conf/log4j2.xml";
   
       public SimpleAuthPlugin(BifroMQPluginDescriptor descriptor) {
           super(descriptor);
           configureLoggerContext(descriptor.getPluginRoot());
           log.info("SimpleAuthPlugin initialized");
       }
   
       @Override
       protected void doStart() {
           log.info("SimpleAuthPlugin started");
       }
   
       @Override
       protected void doStop() {
           log.info("SimpleAuthPlugin stopped");
       }
   
       private void configureLoggerContext(Path rootPath) {
           try {
               Path configPath = 
rootPath.resolve(LOG4J2_CONFIG_FILE).toAbsolutePath();
               File log4jConfig = configPath.toFile();
               if (log4jConfig.exists()) {
                   Configurator.reconfigure(log4jConfig.toURI());
                   log.info("Loaded Log4j configuration from {}", configPath);
               }
           } catch (Exception e) {
               log.error("Failed to configure Log4j", e);
           }
       }
   }
   ```


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to