Uploaded image for project: 'logback'
  1. logback
  2. LOGBACK-1412

Not loading properties from file resource

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • 1.0.13
    • logback-classic
    • None
    • CentOS 6.9
      Java 8

    Description

      When starting the app with a wrapper script

      #!/bin/bash
      DIR=$(dirname $0)
      java -Xms2g -Xmx8g -XX:+UseParallelGC -XX:ParallelGCThreads=2 -XX:-HeapDumpOnOutOfMemoryError -Dcom.sun.management.jmxremote.port=9996 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -cp "${DIR}:${DIR}/lib/*:${DIR}/conf" <redacted> "$@"
      

      I get the following output 

      user@machine:/path/to/my/app$ bash -x /path/to/my/app/wrapper.sh
      ++ dirname /path/to/my/app/wrapper.sh
      + DIR=/path/to/my/app
      + java -Xms2g -Xmx8g -XX:+UseParallelGC -XX:ParallelGCThreads=2 -XX:-HeapDumpOnOutOfMemoryError -Dcom.sun.management.jmxremote.port=9996 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -cp '/path/to/my/app:/path/to/my/app/lib/*:/path/to/my/app/conf' <redacted>
      10:45:02,793 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy]
      10:45:02,794 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml]
      10:45:02,794 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml] at [file:/path/to/my/app/conf/logback.xml]
      10:45:02,937 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set
      10:45:02,943 |-INFO in ReconfigureOnChangeFilter{invocationCounter=0} - Will scan for changes in [[/path/to/my/app/conf/logback.xml]] every 60 seconds.
      10:45:02,943 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - Adding ReconfigureOnChangeFilter as a turbo filter
      10:45:02,972 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
      10:45:02,977 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [STDOUT]
      10:45:03,100 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.rolling.RollingFileAppender]
      10:45:03,106 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [FILE]
      10:45:03,124 |-INFO in ch.qos.logback.core.rolling.FixedWindowRollingPolicy@4d41cee - Will use zip compression
      10:45:03,135 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[FILE] - Active log file name: log.directory_IS_UNDEFINED/app-archiver-archive.log
      10:45:03,135 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[FILE] - File property is set to [log.directory_IS_UNDEFINED/app-archiver-archive.log]
      10:45:03,136 |-ERROR in ch.qos.logback.core.rolling.RollingFileAppender[FILE] - Failed to create parent directories for [/path/to/my/app/log.directory_IS_UNDEFINED/app-archiver-archive.log]
      10:45:03,137 |-ERROR in ch.qos.logback.core.rolling.RollingFileAppender[FILE] - openFile(log.directory_IS_UNDEFINED/app-archiver-archive.log,true) call failed. java.io.FileNotFoundException: log.directory_IS_UNDEFINED/app-archiver-archive.log (No such file or directory)
      at java.io.FileNotFoundException: log.directory_IS_UNDEFINED/app-archiver-archive.log (No such file or directory)
      at at java.io.FileOutputStream.open0(Native Method)
      at at java.io.FileOutputStream.open(FileOutputStream.java:270)
      at at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
      at at ch.qos.logback.core.recovery.ResilientFileOutputStream.<init>(ResilientFileOutputStream.java:28)
      at at ch.qos.logback.core.FileAppender.openFile(FileAppender.java:149)
      at at ch.qos.logback.core.FileAppender.start(FileAppender.java:108)
      at at ch.qos.logback.core.rolling.RollingFileAppender.start(RollingFileAppender.java:86)
      at at ch.qos.logback.core.joran.action.AppenderAction.end(AppenderAction.java:96)
      at at ch.qos.logback.core.joran.spi.Interpreter.callEndAction(Interpreter.java:317)
      at at ch.qos.logback.core.joran.spi.Interpreter.endElement(Interpreter.java:196)
      at at ch.qos.logback.core.joran.spi.Interpreter.endElement(Interpreter.java:182)
      at at ch.qos.logback.core.joran.spi.EventPlayer.play(EventPlayer.java:62)
      at at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:149)
      at at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:135)
      at at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:99)
      at at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:49)
      at at ch.qos.logback.classic.util.ContextInitializer.configureByResource(ContextInitializer.java:75)
      at at ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:148)
      at at org.slf4j.impl.StaticLoggerBinder.init(StaticLoggerBinder.java:85)
      at at org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:55)
      at at org.slf4j.LoggerFactory.bind(LoggerFactory.java:128)
      at at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:107)
      at at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:295)
      at at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:269)
      at at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:281)
      at at app.my.app.archiver.common.app.AbstractArchiverBaseApp.<clinit>(AbstractArchiverBaseApp.java:19)
      10:45:03,137 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [app.my.app.archiver] to INFO
      10:45:03,137 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [FILE] to Logger[app.my.app.archiver]
      10:45:03,139 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
      10:45:03,140 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@33f88ab - Registering current configuration as safe fallback point

      conf/logback.xml contains the following

      <property resource="logging.properties"/>
      

      logging.properties contains 

      log.directory=/var/log/app/xxx/xxx
      

       

      However when I change change logging.properties to app.properties in logback.xml and rename the file I don't get 

      log.directory_IS_UNDEFINED

       

       

      Attachments

        Activity

          People

            logback-dev Logback dev list
            jacob.woffenden Jacob Woffenden
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: