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

Cannot load log4j2 config file if path contains plus '+' characters

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Trivial
    • Resolution: Fixed
    • 2.0-beta9
    • 2.0-rc1, 2.0
    • Core
    • None
    • Mac Pro

    Description

      Hello,

      I was trying to programmatically load a XML config file from the temporary data directory of a MacOS X system. The temp path consists of serveral '+' characters like MacOS automatically generates this path so we have to take it this way. Even I would agree that it is not nice to have '+' chars in a path name.

      When I tried to load the XML config the framework permanently loaded the DefaultConfig and not the desired XML configuration.
      By stepping through the debugger I figured out that this was caused by the method fileFromURI() in org.apache.logging.log4j.core.helpers.FileUtils.java .
      The misbehaviour was basically caused by the call of URL.decode() which converts '+' to ' ' (space) of a given String.
      Now I self-compiled the whole framework without the call of URL.decode() and the XML configuration loaded properly.
      I can not see why this call is necessary in this method so in my opinion this should be removed.

      Kind regards

      Attachments

        Issue Links

          Activity

            People

              rpopma Remko Popma
              J. Tepke Jan Tepke
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - 10m
                  10m
                  Remaining:
                  Remaining Estimate - 10m
                  10m
                  Logged:
                  Time Spent - Not Specified
                  Not Specified