Logging

Mr. XML Publisher uses the Apache Software Foundation's log4j software to log most of its messages (http://logging.apache.org/log4j/index.html). Messages related to performance timing and server-side XML parsing are not logged with log4j. Those messages are sent to wherever your web container is configured to send messages directed to System.out. On clients, log messages from the applets are sent to the client's Java console.

You have the option of accepting the configuration defaults installed with your Mr. XML Publisher system or changing them. You would change them by editing the log4j properties file.

[Caution]Caution

You must provide a valid location and name for a log4j properties file in the "log4j-init-file" <context-par> in Mr. XML Publisher's web.xml file. Mr. XML Publisher cannot start otherwise. It is strongly suggested that you accept the default installation value of "/WEB-INF/log4j.properties".

You need not know all about how to configure log4j to get useful logging from Mr. XML Publisher. The installation defaults will probably suffice; however, you may want to relocate the Mr. XML Publisher log file (XML_Publisher.html) or change which messages get logged ("log-level").

Logging Defaults

Some log messages are sent to the XML_Publisher.html file and some are sent to System.out.

XML_Publisher.html

Mr. XML Publisher's default log4j.properties file directs log4j to create an HTML file named "XML_Publisher.html" and use a log level of "INFO". With a log level of "INFO" Mr. XML Publisher will log many long, detailed messages. It will log virtually everything you would want to know about how it is currently configured, the actions it has taken, and the results.

An example showing startup log messages for a Mr. XML Publisher system on Windows is provided in Example Startup Log Messages. An example showing log messages for complete servicing of a single request is provided in Example Request Servicing Log Messages.

With most supported web containers and JEE servers, log4j creates the XML_Publisher.html file inside a "logs" directory that resides beneath the web container or JEE server's top-most directory. If the "logs" directory does not exist, log4j creates it. Refer to Deployment for information on the default location of the XML_Publisher.html file in each supported web container and JEE server.

When using the "INFO" log level, your XML_Publisher.html file will probably grow too large to easily read. Use the "INFO" log level only when necessary. While learning to control Mr. XML Publisher, and especially while configuring and testing your command arrays, you almost certainly want to use the "INFO" log level. It will provide you with verbose details for every data pull and for every external subprocess it runs. All messages produced by XML transformers or FO processors are included; thus if you plan to help users debug their customization layers, the same server processing messages available to your users are available to you. However, for normal operation, it is recommended that you use the "WARN" log level.

System.out

Log messages sent to System.out are written to a file whose name and location is controlled in the configuration of your web container or JEE server. You cannot control the location or name of that file in Mr. XML Publisher. Log messages sent to System.out include those related to performance timing and server-side XML parsing.

An example showing System.out log messages for a Mr. XML Publisher system on Windows is provided in Example System.out Log Messages. You can turn off logging for performance timing with the PERFORMANCE_TIMING <context-param> in the web.xml file, but you cannot turn off logging of messages generated by server-side XML parsing.

Rename or Relocate the Mr. XML Publisher Log File

To change the default name or location of the Mr. XML Publisher log file, simply edit the "log4j.appender.file.File" property value in the log4j.properties file. To otherwise modify the log file, you should probably first consult the log4j documentation (http://logging.apache.org/log4j/). The customization permitted with log4j is quite extensive.

Change the Log Level

You cannot turn logging off completely; however, you can adjust the log level so as to log fewer or more messages. In the default installation's log4j.properties file, in the very last line, you will find a line that reads "log4j.category.com.swhitlat=INFO". In that line, you would change "INFO" to "TRACE", "DEBUG", "WARN", "ERROR", or "FATAL". For normal operation, you should use "WARN". Use "INFO" only temporarily; otherwise your log file will probably grow too large to read.