You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by Finn Bock <bc...@worldonline.dk> on 2004/09/10 15:53:40 UTC

Re: [proposal] How to do logging from the command line

[Jeremias]

> Hi Finn,
> 
> I took a look at it and I must say that I'm a bit confused, too.
> 
> Anyway, I have a proposal to make. I would expect a command-line
> application to work like any other C-program such as "grep", "svn", "ls" or
> whatever. That means you don't get any "[INFO]" before each line, but
> you can define the log level (normally "quiet", "normal" and "verbose")
> through command line switches. That'll work for most CLI-users.
> 
> Since the Fop class is the one to control the whole application it (or
> rather the CommandLineOptions class) can also set up C-L to behave
> exactly as explained above. That would probably mean not to use
> SimpleLog but to provide a special implementation for command-line use.
> At any rate, I don't agree with the way that SimpleLog is implemented.
> Informational messages should go to System.out, errors to System.err.
> Logging prefixes should be disabled. I've had to do the same for Avalon
> Logging in Barcode4J [1] and I'm very pleased with the result. Using
> this I was able to implement the Barcode4J CLI in a way that the
> generated barcode could be output to System.out which may also be
> desirable for certain people. You could even modify the whole thing in
> way that you could implement FOP as a filter application getting the
> input through System.in and sending the output to System.out, giving
> error messages through System.err.
> 
> For those who know about C-L and want to do some special logging we
> could have a command line switch that disables our special logger setup.
> They can fully control C-L from outside.
> 
> For the cases where FOP is used embedded in a bigger software, FOP
> shouldn't manipulate anything in C-L, it's simply the developer's job to
> set up C-L from outside.
> 
> WDYT?

I like it. It will get consistent results for command line users without 
  them (practicly) ever having to do any logging configuration.

I have added a patch with an implementation of your proposal. Feel free 
to point out any mistakes that I have made.

Glen, I'm a bit confused about your objections. I don't think they apply 
to Jeremias' proposal at all.

- SimpleLog plays *no* part in this.
- There is no wrapping of c-l in any way, we just supply own very
   simple specialized logging implementation.
- Users can still use other c-l loggers (jdk14, log4j, etc.) by
   setting LOGCHOICE in fop.bat

regards,
finn