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

document programmatically changing log settings

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.15.0
    • None
    • None

    Description

      i was looking for a way to reconfigure the log of a high traffic web application via GUI or API. the application writes its log via log4j2 2.14.1 to stdout, and optionally into a file, rolling. the following i tried to do programmatically:

      1. change the log level, e.g. from ERROR to DEBUG.
      2. switch between writing to a log file, or not.
      3. save the current settings into a config file so next time the application comes up the settings still are active.
      4. reset to the factory settings.

      if somebody knowledgeable could amend the documentation with how log4j2 supports to set a single value to a different value at runtime. add/remove parts of the configuration, reset all of the configuration to the factory settings would be helpful. maybe just add an overview glue, if the details are already there. the page i found was:

      https://logging.apache.org/log4j/2.x/manual/customconfig.html

      in this page the following method mentioned is deprecated:
      Appender appender = FileAppender.createAppender("target/test.log", "false", "false", "File", "true","false", "false", "4000", layout, null, "false", null, config);

      Attachments

        Activity

          People

            Unassigned Unassigned
            soloturn solo turn
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: