Uploaded image for project: 'Log4j 2'
  1. Log4j 2
  2. LOG4J2-913

Allow to load log4j2 configuration from a centralized repository, like a database or a webservice

    XMLWordPrintableJSON

Details

    Description

      Hi.

      I've worked in some projects that require having a single configuration point for all my loggers since basically, all of them are web applications. Since controlling the logging event flood can be problematic when the applications are in production, it would be great if, along with the current XMLConfiguration and JSONConfiguration, there would be a configuration mechanism that could load the log4j2 from a remote location, whether it's a webservice (SOAP, ReST) or a database.

      The contract can be summarized like this:

      • Set a configuration endpoint
      • Set a polling interval
      • Allow authentication
      • Load a given named configuration
      • Reconfigure if required.

      Right now, I'm been scratching this need by code, using a ScheduledExecutorService and a pice of code like this:

              LoggerContext ctx = null;
              URI uri = null;
              try {
                  uri = new URI("http://localhost:7001/log4j2config/getlog4j2xmlconfig?appCode=log4jConfig&section=full");
              } catch (URISyntaxException e) {
                  System.err.println(e.getMessage());
              }
              ctx = Configurator.initialize("Log4J2Conf", Thread.currentThread().getContextClassLoader(), uri);
              ctx.start();
      

      However, I believe that since this is a common scenario, it could be implemented as a new plugin.

      Thank you very much.

      Attachments

        Activity

          People

            rgoers Ralph Goers
            edwinflopez Edwin F. López
            Votes:
            4 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: