In summary, the issue here is that logback configuration with XML automatically looks at System.properties in trying to resolve an expression of the form ${property_name}, whereas Groovy requires an explicit initial def statement from "System.properties" to create an initial definition in the groovy namespace.

Once "property" is defined in the Groovy namespace, "${property}" can be resolved. But groovy will not automatically resolve "${property}" when "property" is the key of a system property.

On 08/24/2012 06:30 PM, Steve Cohen wrote:
Yes, that is right.

I changed it to

def logdir = System.properties.getProperty('files.root')+"/logdir"

and it works.

there's probably a "groovier" way of handling that but I don't know what
that is.

Perhaps the translator might be improved to handle such occurrences.

On 08/24/2012 06:16 PM, ceki wrote:

If I understand correctly, removing the line "def logdir==..." allows
the logback.groovy script to be successfully parsed ?

On 25.08.2012 01:08, Steve Cohen wrote:
Thanks, Robert, now we are getting somewhere.

Indeed, my logback.groovy contains the line
     def logdir = ${files.root}/logdir

This came from a translation of my logback.xml by ceki's handy converter
webpage.  Logback.xml had
     <property name="logdir" value = "${files.root}/logdir" />

where files.root is the name of a System property.

So the question is, is there a way to express a system property name in
groovy and what is it?

Steve

Indeed
On 08/24/2012 02:50 PM, Robert Elliot wrote:
I haven't used the groovy config, but it sounds to me like you
effectively have a compile error in your config - you are using the
word "files" as an identifier somewhere where the Logback groovy
config is not expecting it.

Groovy DSLs tend to work by doing a lot of clever stuff around syntax,
building on the fact that at compile time Groovy doesn't know what
properties may be available on a class at runtime.  Consequently you
don't get compile time indicators as to whether you are getting the
syntax of the DSL right; instead it fails at runtime, complaining that
a property was not present.

Rob

On 24 Aug 2012, at 20:00, Steve Cohen <sco...@javactivity.org> wrote:

After upgrading to logback-1.0.7 and groovy 2.0.0, the problem below
continues to be an issue and I am unable to make progress with it.
The error messages are the same.

Failed to instantiate [ch.qos.logback.classic.LoggerContext]
Reported exception:
groovy.lang.MissingPropertyException: No such property: files for
class: Script1

I am no groovy expert.  I want to use groovy only because it offers a
terser notation than xml configuration that would enable me to more
easily manage my configuration on the fly.

But I can't get past this error or know what it even means.

    No such property: files for class: Script1

I have no clue how to solve this.  Can someone please help?  What is
it trying to tell me?  I know of no "Script1"

Steve



_______________________________________________
Logback-user mailing list
Logback-user@qos.ch
http://mailman.qos.ch/mailman/listinfo/logback-user



_______________________________________________
Logback-user mailing list
Logback-user@qos.ch
http://mailman.qos.ch/mailman/listinfo/logback-user



_______________________________________________
Logback-user mailing list
Logback-user@qos.ch
http://mailman.qos.ch/mailman/listinfo/logback-user

Reply via email to