System logs capture any errors in the code running the server, but can be configured to capture more information for debugging. If you suspect a problem or cannot pinpoint an error, you can turn log collectors on and off to capture logs while you test your issue.
This chapter contains the following sections:
• | Log File Location |
• | Managing Log Settings |
• | Log Configuration Files |
• | Adding a Logger to the Log Settings Page |
Log File Location
JasperReports Server uses the Apache log4j package to generate log files. Jaspersoft uses the slf4j facade to wrap log4j.
• | The default log file is .../WEB-INF/logs/jasperserver.log. |
• | The default log configuration file is .../WEB-INF/log4j.properties. |
To view the log file, you must have access to the file system where JasperReports Server is installed. This chapter describes the settings that control the information JasperReports Server writes to its logs.
Managing Log Settings
To set the current logging levels:
1. | Log in as administrator (jasperadmin by default). |
2. | Select Manage > Server Settings and choose Log Settings in the left-panel. |
3. | In the Log Settings panel, use the drop-down selectors to change the log level for each class being logged. |
System Log Settings |
The page lists some of the currently-enabled loggers with their logging level. Any change to the logging levels takes effect immediately, without restarting JasperReports Server.
These logging levels override the levels in the log4j.properties file, so the values on the Log Settings page (those that are in effect) may differ from settings in the log4j.properties file. For details, see Configuration Settings in the User Interface. |
The four logging levels indicate the type of event recorded by a logger:
Setting | Level of Information |
ERROR | Writes minimal information to the log, only when describing serious program faults. |
WARN | Writes error and warning messages to the log. Warning messages contain cautionary information to help you to decide whether the logged events require your attention. |
INFO | Writes error, warning, and informational messages to the log describing significant events, such as those that affect application performance. |
DEBUG | Writes error, warning, informational, and additional messages to the log. Debug messages are very detailed and often voluminous. Use this setting only to diagnose a problem. DEBUG can impact system performance and should not be used in production environments. If several loggers are set to DEBUG, the server may generate huge logs, and performance can suffer. |
JasperReports Server's default root logger setting is ERROR, as configured in log4j.properties. A logger without an assigned value inherits the setting of its parent in log4j.properties.
The following table lists each logger name as it appears on the Log Settings page, the identifier used to find it in the log file, and a description of the logger.
Logger Name | Identifier in Log | Description |
SQL query executer | JRJdbcQueryExecuter | Logs SQL text and parameter values for queries that are run by the SQL query executer. |
Input control value queries | valueQueryLog | Logs SQL text and parameter values for queries associated with input controls. |
Cascading input control parameter resolution | FilterCore | Logs activity associated with cascading input controls. Query-driven input controls can cascade when a query has a parameter whose value comes from another input control. When the parameter value is changed, the query is automatically rerun, possibly changing the list of values for its input control. |
Cascading input control query result caching | TokenControlLogic | Logs use of the cache for results of cascading input control queries. |
Profile attributes resolver | ProfileAttributesResolverImpl | Determines the values of attributes when they are referenced. |
Hibernate SQL | SQL | Logs SQL run by the Hibernate layer to access the JasperReports Server repository database. This logger generates a large volume of logging that could affect performance. |
You can add other loggers to the Log Settings page if you know their classnames.
To add a logger to the page from the web interface:
1. | Log in as administrator (jasperadmin by default). |
2. | Select Manage > Server Settings and choose Log Settings in the left panel. |
3. | Scroll to the bottom of the page. |
4. | Enter the logger's classname in the text field. See the other properties on the page for guidance, for example: |
com.jaspersoft.ji.adhoc.action.AdhocCrosstabAjaxController
5. | Use the drop-down to set the logging level. |
The logger setting is persistent even when the server is restarted. However, the logger setting may not appear on the Log Settings page again. For information about adding loggers to this page permanently, see Adding a Logger to the Log Settings Page.
Log Configuration Files
You can edit the log configuration file to set loggers, logging levels, and log output, but you must restart the server for your changes to take effect.
If you've made modifications in the Log Settings UI, those settings are persistent in the repository, and take precedence over the configuration files. However, these changes are not written to the configuration files. Each setting is independent, so a value that's not modified in the Log Settings UI is taken from the corresponding file. For more information, see Configuration Settings in the User Interface.
Logger names are defined in the Java source. Loggers can have any name, but the Jaspersoft convention is to give them their full class names. In the log4j.properties file, the classname must be preceded by log4j.logger. For example, the classname org.acegisecurity.intercept is represented in the log4j.properties file as log4j.logger.org.acegisecurity.intercept. If you want to add a new logger, find its classname in the source.
The file you edit depends on whether you're configuring server logging or logging during import and export.
Functionality to Log | File Location |
Import or Export | <js-install>/buildomatic/conf_source/iePro |
JasperReports Server | .../WEB-INF/log4j.properties |
If the logger is defined in the configuration file but commented out, simply remove the comment character (#) to add the logger. Otherwise, add the logger's classname and set the logging level.
The form of a logger definition should be:
log4j.logger.<logger-classname> = <log-level>, <output-type>
where:
• | <logger-classname> is the name of the class you want to monitor. |
• | <log-level> is ERROR, WARN, INFO, or DEBUG |
• | <output-type> is a standard output type, such as stdout. For example: |
log4j.logger.org.springframework.webflow=DEBUG, stdout, fileout
Restart the server for your changes to take effect.
Adding a Logger to the Log Settings Page
If you know of a log4j logger that JasperReports Server uses, you can add it to the Log Settings page available to the administrator. To add a logger, edit a configuration file.
Because editing text files can be error-prone, we recommend that you add loggers from the web interface by entering them into the text field on the Log Settings page. Edit the configuration file only if you need to permanently add the logger. |
To edit the list of loggers to be displayed on the page:
1. | Edit the file .../WEB-INF/bundles/logger_descriptions_pro.properties. |
2. | Add a new line and specify the logger's classname and a brief description of it. |
Entries should be in the form <logger-classname> = <description>.
See the other properties in the file for guidance, for example:
com.jaspersoft.ji.adhoc.action.AdhocCrosstabAjaxController = Crosstab controller
3. | Restart the server for your changes to take effect. |
The logger_descriptions_pro.properties file controls the labels for the English locale. You can specify labels for other locales by editing the logger description property files for those locales. For example, to add the label in French, add an entry to the logger_descriptions_pro_fr.properties file. For more information on supporting other languages, refer to Localization. |
Recommended Comments
There are no comments to display.