On 02.04.2004 12:59:00 Chris Bowditch wrote:
> Jeremias Maerki wrote:
> <snip/>
> > As you may have seen I added a cvsignore file in the src directory. The
> > idea is to put a simplelog.properties (or other such configuration file) in
> > the src/private-resources directory so you can configure the SimpleLog
> > logger from Commons Logging.
> > 
> > My current simplelog.properties looks like this:
> > org.apache.commons.logging.simplelog.showShortLogname=false
> > org.apache.commons.logging.simplelog.defaultlog=info
> > org.apache.commons.logging.simplelog.log.org.apache.fop.pdf=trace
> > 
> > Info about simplelog.properties can be found at [1].
> Well Ive created the file on my hard disk as you suggest. But shouldnt this 
> really be kept in CVS, with default settings. Obviously users will be expected 
>   to change the defaults. If a sample file is not kept in CVS, then every user 
> is going to have to look in archives in order to find out how to get logging 
> turned on. I know we dont have many users of HEAD yet, but I want us to 
> consider what is going to happen longer term .....

Well, JCL provides some reasonable default without any additional
configuration. I added the directory to cvsignore because I don't want
to accidently upload my private modifications to my log configuration.
If you think there should be a default configuration we can provide such
a file, but hopefully in a different directory.

> > 
> > One additional thing is to add a system property to each startup
> > configuration in your IDE where you need to configure logging. Working
> > with Eclipse I've added...
> > 
> > -Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog
> We would need to add this to FOP.sh or FOP.bat in CVS

We could. But I expect a command-line application to write all its
output to System.out/err exclusively. See PFMReader and TTFReader where
I explicitely set up Commons Logging to write to the console. The system
property above is only necessary for embedded use.

> <snip/>
> > For setting up Commons Logging for a command-line application, please
> > see PFMReader and TTFReader for how I think it should be done. I'm not
> > entirely comfortable, yet, as SimpleLog logs everything to System.err.
> > For Barcode4J I wrote a special ConsoleLogger (for Avalon Logging) [4] that
> > logs only WARN, ERROR and FATAL levels to System.err while sending the
> > rest to System.out. Also, there's no possibility to get rid of the log
> > level prefix in SimpleLog. In the end, it would probably be best to
> > create a special CommandLineLog class which is tailored to this use case.
> Will embedded users be able to write a Logger that overrides the default 
> SimpleLog, and captures the output to file, rather than System.err?

Sure, they can use Log4J, LogKit, JDK 1.4 logging to write to any file,
email, SNMP or whatever. They don't even have to write a logger because
Log4J, for example, can already do everything. Just have a look at the
JCL documentation.

Jeremias Maerki

Reply via email to