Perl programmer for hire: download my resume (PDF).
John Bokma's Hacking & Hiking

Getting rid of [INFO] FoUserAgent on Linux

January 5, 2019

Today I was working on my homebrew invoice rendering program which uses the Saxon XSLT processor and Apache FOP. The latter program reports for each invoice rendered a log line in the terminal as follows:

[INFO] FOUserAgent - Rendered page #1.

But how to suppress this info message? The fop command itself does not have a switch to turn off such log messages. After some Googling I didn't find a solution so I decided to check the fop program itself, which I recalled to be a wrapper shell script. I located this script using:

which fop

Which reported:

/usr/bin/fop

I opened this shell script using:

sudo vi /usr/bin/fop

And found an easy solution to the above issue: changing the log level from INFO to WARN. The latter makes fop still log warnings, errors, and fatal issues, which I consider important enough to see. I changed the following line:

LOGLEVEL=-Dorg.apache.commons.logging.simplelog.defaultlog=INFO

Into:

LOGLEVEL=-Dorg.apache.commons.logging.simplelog.defaultlog=WARN

I saved the file and quit vi using :wq.

After this change no more rendered page info messages on the terminal. Note that this change is system wide, so if you run software which relies on the previous behavior it might break.

Apache FOP related