Configure Logging for YouTrack JAR
YouTrack logs are written in several files. The primary log file is youtrack.log.
YouTrack logs are located in the <USER_HOME>/.youtrack/logs directory.
Logs are collected using the Apache log4j logging library.
To modify logging levels in YouTrack, configure the logging properties in the youtrack-xxxxx.jar!/WEB-INF/lib/charisma-app-xxxx.jar!/jetbrains/charisma/main/log4j.xml file.
Modifying logging properties in other files does not affect YouTrack logs.
If you don't want to edit the default system configuration, you can create your own custom log4j configuration.
To use your custom log4j configuration, provide the full path to your log4j.xml file with the jetbrains.mps.webr.log4jPath Java start parameter.
The JVM option for starting YouTrack with this start parameter looks something like this:
-Djetbrains.mps.webr.log4jPath=/users/YouTrack/conf/log4j.xmlLimit Logging Levels
You can customize the logging to print only events for a specific logging level.
For example, you want to limit logging in the youtrack.log file to the WARN level.
To set the logging threshold:
-
Open the
log4j.xmlfile and locate the following code:<appender name="FILE" class="jetbrains.charisma.main.MultiplexingRollingFileAppender"> <param name="File" value="/logs/youtrack.log"></param> <param name="MaxFileSize" value="10Mb"></param> <param name="MaxBackupIndex" value="30"></param> <layout class="org.apache.log4j.PatternLayout"><param name="ConversionPattern" value="%d{DATE} %-5p [%-30.30c{1}] [%-50.50t] %\m%\n"></param> </layout> </appender> - To limit logging to events with the
WARNlevel or higher, add the following parameter to the file:<param name="Threshold" value="LEVEL"></param>For example:
<appender name="FILE" class="jetbrains.charisma.main.MultiplexingRollingFileAppender"> <param name="File" value="/logs/youtrack.log"></param> <param name="MaxFileSize" value="10Mb"></param> <param name="MaxBackupIndex" value="30"></param> <param name="Threshold" value="WARN"></param> <layout class="org.apache.log4j.PatternLayout"><param name="ConversionPattern" value="%d{DATE} %-5p [%-30.30c{1}] [%-50.50t] %m%n"></param> </layout> </appender> - Save and close the
log4j.xmlfile.That's it!
Available Logging Levels
The following levels of logging are available: