[stringtemplate-interest] Logging framework?
Terence Parr
parrt at cs.usfca.edu
Tue May 3 16:52:02 PDT 2011
hi Barrie, I appreciate your analysis and suggestions. At the moment, I think I will leave out the logging. certainly it would be pretty difficult to convince me to introduced a library dependency for logging. I should probably just implement better logging :) sorry for the trouble.
Ter
On Apr 17, 2011, at 6:33 PM, Barrie Treloar wrote:
> On Sun, Apr 17, 2011 at 5:14 AM, Terence Parr <parrt at cs.usfca.edu> wrote:
>> Hi Barrie. Did java -v help? Guess that only helps with loading classes not other things via the class path. What information ended up being helpful to you?
>
> I haven't tried -v (did you mean -verbose:class) but like you I
> suspect its not good for other things via the classpath.
>
> I found the problem by looking at code:
> STGroupDir.load(String name)
> try {
> is = groupFileURL.openStream();
> }
> catch (FileNotFoundException fnfe) {
> // must not be in a group file
> return loadTemplateFile(parent, name+".st"); // load t.st file
> }
>
> Since it was appending ".st" I realized I shouldn't be including it.
>
> The error you get when you include the ".st" suffix is:
> java.lang.RuntimeException: Unable to load instance of template
> "cls.st" from templateGroup: src/main/ST (ANT#49)
>
> But cls.st exists in that directory - so I couldn't work out why the
> template wasn't being found.
>
> If I could enable logging then I would expect to see something like:
> 18/04/2011 10:51:59 DEBUG org.stringtemplate.v4.STGroupDir -
> Attempting to locate group file src/main/ST.stg
> 18/04/2011 10:51:59 DEBUG org.stringtemplate.v4.STGroupDir - Group
> file src/main/ST.stg does not exist
> 18/04/2011 10:51:59 DEBUG org.stringtemplate.v4.STGroupDir -
> Attempting to locate template file src/main/ST/cls.st.st
> 18/04/2011 10:51:59 DEBUG org.stringtemplate.v4.STGroupDir - Template
> file src/main/ST/cls.st.st does not exist
>
> Which would make it obvious what I've done wrong.
>
> This level of detail goes beyond what the simple boolean STGroup.verbose gives.
>
> So the questions become:
> 1) Are you happy with STGroup.verbose?
> 2) If you are unhappy with STGroup.verbose, is it worth looking at logging?
> 3) What logging framework - java.util.logging, log4j (or using
> http://commons.apache.org/logging/ so that your libraries dont impose
> a logging framework on others)
>
> Based on these answers, I can sprinkle in the logging statements I
> expected to see to help trouble shoot problems.
>
> Regards
> Barrie
> _______________________________________________
> stringtemplate-interest mailing list
> stringtemplate-interest at antlr.org
> http://www.antlr.org/mailman/listinfo/stringtemplate-interest
More information about the stringtemplate-interest
mailing list