| 1 |
=== Logging === |
| 2 |
|
| 3 |
You can configure logging by using the Java -Dlog.config=filename option. |
| 4 |
This option uses a logging configuration file that allows you to enable and |
| 5 |
disable specific logging messages. This is useful if you want to see |
| 6 |
certain types of message that are not logged by default or choose where the |
| 7 |
messages should be written. The configuration file contains details of the |
| 8 |
handler(s) used to write the messages, parameters used to format the |
| 9 |
messages and the severity of messages that should be logged at Java package |
| 10 |
or class level, plus a default value. An example file is: |
| 11 |
|
| 12 |
<pre> |
| 13 |
# The default level FINE, WARNING, INFO, SEVERE |
| 14 |
.level=SEVERE |
| 15 |
handlers: java.util.logging.FileHandler java.util.logging.ConsoleHandler |
| 16 |
# package or class name with .level appended and then the level |
| 17 |
uk.me.parabola.imgfmt.level=INFO |
| 18 |
uk.me.parabola.mkgmap.build.level=INFO |
| 19 |
uk.me.parabola.mkgmap.main.Main.level=INFO |
| 20 |
uk.me.parabola.mkgmap.main.MapMaker.level=INFO |
| 21 |
uk.me.parabola.mkgmap.general.RoadNetwork.level=INFO |
| 22 |
uk.me.parabola.mkgmap.general.MapLine.level=INFO |
| 23 |
uk.me.parabola.mkgmap.osmstyle.level=INFO |
| 24 |
uk.me.parabola.mkgmap.reader.osm.level=INFO |
| 25 |
uk.me.parabola.mkgmap.reader.osm.xml.level=INFO |
| 26 |
uk.me.parabola.mkgmap.reader.osm.RestrictionRelation.level=FINE |
| 27 |
uk.me.parabola.mkgmap.reader.osm.Restriction.level=FINE |
| 28 |
# For ConsoleHandler |
| 29 |
java.util.logging.ConsoleHandler.level=WARNING |
| 30 |
java.util.logging.ConsoleHandler.formatter=uk.me.parabola.log.UsefulFormatter |
| 31 |
# For FileHandler |
| 32 |
java.util.logging.FileHandler.level=FINE |
| 33 |
java.util.logging.FileHandler.encoding=UTF-8 |
| 34 |
java.util.logging.FileHandler.formatter=uk.me.parabola.log.UsefulFormatter |
| 35 |
java.util.logging.FileHandler.limit=20000000 |
| 36 |
java.util.logging.FileHandler.count=4 |
| 37 |
java.util.logging.FileHandler.pattern=mkgmap.log |
| 38 |
java.util.logging.FileHandler.append=false |
| 39 |
</pre> |
| 40 |
|
| 41 |
The above example enables certain informational messages and uses FileHandler to send |
| 42 |
them to a log file, with warning and error messages being also sent to stderr via |
| 43 |
ConsoleHandler. |
| 44 |
|
| 45 |
Mkgmap provides UsefulFormatter to help format messages, but you can use the |
| 46 |
standard Java SimpleFormatter if you prefer. |
| 47 |
|
| 48 |
In addition to the standard Java levels, mkgmap uses three additional levels |
| 49 |
DIAGNOSTIC (1100), ECHO (1200) and OVERRIDE (1300) for messages from its |
| 50 |
diagnostic options, echo/echotags style compiler actions and to display |
| 51 |
mkgmap startup and completion information. You can use the numeric values but |
| 52 |
not the names to specify these levels in a logging configuration file. |
| 53 |
|
| 54 |
Further information can be found at |
| 55 |
[https://docs.oracle.com/javase/8/docs/technotes/guides/logging/overview.html https://docs.oracle.com/javase/8/docs/technotes/guides/logging/overview.html] |
| 56 |
|
| 57 |
If you see messages that contain non-ASCII characters which are not displaying |
| 58 |
properly in the console, you may need to use the Java -Dfile.encoding=<codepage> |
| 59 |
option and/or precede the mkgmap command line with a chcp command to make |
| 60 |
sure that the Java environment has the same code page as the shell it is |
| 61 |
being run from. This is especially likely on the Windows platform where the |
| 62 |
Java environment uses the Windows default code page, but the Windows command |
| 63 |
shell normally uses a different code page. |