Uploaded image for project: 'Red Hat Fuse'
  1. Red Hat Fuse
  2. ENTESB-9503

Configuring "org.ops4j.pax.logging" properties through JMX causing property placeholders to be replaced

XMLWordPrintable

    • % %
    • Hide

      1. start Fuse container;

      2. login to hawtio web console, then invoke the following setProperty operation on Hawtio JMX Page:
      org.apache.karaf:type=config,name=root::setProperty(java.lang.String,java.lang.String,java.lang.String)
      P1: org.ops4j.pax.logging
      P2: log4j.appender.out.maxFileSize
      P3: 20MB

      3. check container's "etc/org.ops4j.pax.logging.cfg" file:

      $ cat org.ops4j.pax.logging.cfg |grep log4j.appender.out.file
      log4j.appender.out.file = /apps/jboss/fuse/6.3/r8/orig/jboss-fuse-6.3.0.redhat-347/data/log/fuse.log
      $ cat org.ops4j.pax.logging.cfg |grep log4j.appender.sift.appender.file
      log4j.appender.sift.appender.file = /apps/jboss/fuse/6.3/r8/orig/jboss-fuse-6.3.0.redhat-347/data/log/${bundle.name}.log
      

      The file "etc/org.ops4j.pax.logging.cfg" entries "log4j.appender.sift.appender.file" and "log4j.appender.sift.appender.file" were changed. The property placeholder "${karaf.data}" was automatically replaced. And the other one

      $\\{bundle.name\\}"
      

      was changed to "${bundle.name}" as all of the escape characters '\' were removed.

      4. invoke the same JMX operation setProperties again on a different property:
      P1: org.ops4j.pax.logging
      P2: log4j.appender.out.maxBackupIndex
      P3: 20

      5. check container's "etc/org.ops4j.pax.logging.cfg" file again:

      $ cat org.ops4j.pax.logging.cfg |grep log4j.appender.out.file
      log4j.appender.out.file = /apps/jboss/fuse/6.3/r8/orig/jboss-fuse-6.3.0.redhat-347/data/log/fuse.log
      $ cat org.ops4j.pax.logging.cfg |grep log4j.appender.sift.appender.file
      log4j.appender.sift.appender.file = /apps/jboss/fuse/6.3/r8/orig/jboss-fuse-6.3.0.redhat-347/data/log/.log
      

      This time. the other property placeholder "${bundle.name}" was replaced with nothing because the property "bundle.name" does not have a value.

      Show
      1. start Fuse container; 2. login to hawtio web console, then invoke the following setProperty operation on Hawtio JMX Page: org.apache.karaf:type=config,name=root::setProperty(java.lang.String,java.lang.String,java.lang.String) P1: org.ops4j.pax.logging P2: log4j.appender.out.maxFileSize P3: 20MB 3. check container's "etc/org.ops4j.pax.logging.cfg" file: $ cat org.ops4j.pax.logging.cfg |grep log4j.appender.out.file log4j.appender.out.file = /apps/jboss/fuse/6.3/r8/orig/jboss-fuse-6.3.0.redhat-347/data/log/fuse.log $ cat org.ops4j.pax.logging.cfg |grep log4j.appender.sift.appender.file log4j.appender.sift.appender.file = /apps/jboss/fuse/6.3/r8/orig/jboss-fuse-6.3.0.redhat-347/data/log/${bundle.name}.log The file "etc/org.ops4j.pax.logging.cfg" entries "log4j.appender.sift.appender.file" and "log4j.appender.sift.appender.file" were changed. The property placeholder "${karaf.data}" was automatically replaced. And the other one $\\{bundle.name\\}" was changed to "${bundle.name}" as all of the escape characters '\' were removed. 4. invoke the same JMX operation setProperties again on a different property: P1: org.ops4j.pax.logging P2: log4j.appender.out.maxBackupIndex P3: 20 5. check container's "etc/org.ops4j.pax.logging.cfg" file again: $ cat org.ops4j.pax.logging.cfg |grep log4j.appender.out.file log4j.appender.out.file = /apps/jboss/fuse/6.3/r8/orig/jboss-fuse-6.3.0.redhat-347/data/log/fuse.log $ cat org.ops4j.pax.logging.cfg |grep log4j.appender.sift.appender.file log4j.appender.sift.appender.file = /apps/jboss/fuse/6.3/r8/orig/jboss-fuse-6.3.0.redhat-347/data/log/.log This time. the other property placeholder "${bundle.name}" was replaced with nothing because the property "bundle.name" does not have a value.

      When configuring "org.ops4j.pax.logging" PID properties through JMX setProperty operation, any property with property placeholders gets replaced automatically. For instance, the following two properties:

      log4j.appender.out.file=${karaf.data}/log/fuse.log
      log4j.appender.sift.appender.file=${karaf.data}/log/$\\{bundle.name\\}.log
      

      After invoking setProperty JMX operations twice, above properties are changed to:

      log4j.appender.out.file = /apps/jboss/fuse/6.3/r8/orig/jboss-fuse-6.3.0.redhat-347/data/log/fuse.log
      log4j.appender.sift.appender.file = /apps/jboss/fuse/6.3/r8/orig/jboss-fuse-6.3.0.redhat-347/data/log/.log
      

      Tested against Red Hat Fuse 6.2.1 R4, 6.3 R4 and 6.3 R8 and the problem persists in all of the versions.

              ggrzybek Grzegorz Grzybek
              rhn-support-qluo Joe Luo
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: