## Configuring logs

JReport provides a robust, flexible and configurable logging system, which is based on log4j version 1.2.8. JReport also supports versions of log4j version 1.2.8 to 1.3alpha7.

The logging system is used for obtaining meaningful and helpful JReport logging information in a convenient way. It is easy to configure and manage. The following are the significant benefits of the JReport logging system:

- It is compatible with your application which is based on log4j.
- It can be configured to output the logging information of different modules separately or to output them all together.
- It supports setting the trace and error type level separately.

### Configuring logs

Log configuration tasks can be achieved in three ways. They are:

- Using the JReport Administration page > Configuration > Log panel.
- Using the LogConfig.properties file located in `<install_root>\bin` directory.
- Using command options.

  In comparison with earlier versions, the command options used for log configuration have undergone a considerable change. The following are descriptions of these options:

  Options | Description
  --- | ---
  -vDebug | Enables JReport Engine to output messages to a file and sets engine log file's trace level to INFO and error level to WARN.
  -vError | Enables JReport Engine to output messages to a file and sets engine log file's trace level to OFF and error level to ERROR.
  -logall | Sets all loggers' trace level to INFO and error level to WARN.
  -log[:file Name] | Outputs JReport Engine messages to the file as specified and uses the -vDebug level.

  Note: Any settings made using the command options will override the trace and error type level settings in the LogConfig.properties file.

### Logging information using the trace and error type

The JReport logging system enables you to trace both normal and abnormal situations by using the trace and error type. Trace is used for logging something expected or regular, such as tracing a program workflow, logging runtime information and associated elements. Error is used for logging something unexpected or irregular. For example, when a URL is unreachable, a file does not exist, or a table cannot be found in a data source.

Trace type is divided into four levels, and is ordered according to the amount of information logged, from the least to the most. These levels are OFF, OUTLINE, INFO, and TRIVIAL. Similarly, error type is also divided into four levels, and is ordered according to the amount of information logged, from the least to the most. These levels are OFF, FATAL, ERROR, and WARN. For detailed information about the eight levels, see Log panel.

If you want the least amount of information to be logged, you can set trace level to OFF and error level to ERROR. If you want the most amount of information to be logged, you can set trace level to TRIVIAL and error level to WARN. Setting these to the highest level could affect system performance as well as disk usage.

### Customizing log file location

You can customize where to output logs in your local disk instead of using the default directory `<install_root>\logs`.

By default, different log categories are output to different rolling files. For example, the Engine log is output to Engine.log in the `<install_root>\logs` directory. If you want to customize the location of the Engine log file, take the following steps:

1. Open the LogConfig.properties file located in the `<install_root>\bin` directory.
2. Modify the parameter log4j.appender.EngineRollingFile.File. Set its value to an absolute path with a log file name, for example: `C:\logs\Engine.log` (on Windows) or `/logs/Engine.log` (on Linux/Unix).
3. Save the LogConfig.properties file.
4. Restart JReport Server.

### Configuration settings - effect on performance

The following are configuration properties which have an effect on server performance:

- If the showTitle property is set to true in the LogConfig.properties file, the log file size will increase. However, the effect on performance is negligible.
- The levels of trace and error affect the amount of logging output. The higher the level, the more the output. The settings for error level will have a negligible affect on performance but a high level for trace may affect performance.
- The use of the following conversion characters in ConversionPattern property results in the slow generation of caller class or location information: %C, %F, %L and %M. Their use should be avoided unless execution speed is not an issue. For information about the ConversionPattern property, see comments in the LogConfig.properties file, which is located in the `<install_root>\bin` directory.