Q:

using javax.tools.JavaCompiler etc

I am looking for working examples of Oracle's Java Compiler API usage. I want to build something close to javac to customize/extend errors logging capabilities.

A:

See the STBC (the SSCCE Text Based Compiler).  The source is available in stbc.zip.
 

