How to Enable Additional Debug Logging
Teamscale can be configured to print detailed debug log messages for specific parts of the application. This can be helpful to better comprehend Teamscale's behavior.
In this example, we want to enable debug logging for all classes inside the com.teamscale.core.authenticate.ldap
package.
Inside the config
folder of your Teamscale directory, you will find the configuration file log4j2.yaml
with the default configuration and the following commented-out example:
Configuration:
appenders: # The appenders define how messages are logged.
# File:
# # This appender (if uncommented) writes all messages to logs/ldap.log.
# # This appender is referenced by name LdapLog in the logger configuration below.
# - name: LdapLog
# fileName: logs/ldap.log
# PatternLayout:
# Pattern: "* %-5level [%threadName] %date:%variablesNotEmpty{ %mdc{job}:} %message%n"
# # This appender (if uncommented) writes all messages with marker "Voting" to logs/voting.log.
# # This appender is referenced by name VotingLog in the logger configuration below.
Loggers: # The loggers define which messages are routed to which appenders.
# # Configuration for the "LdapLog" file appender example above that also logs level info to the appender.
# - name: com.teamscale.core.authenticate.ldap # name of the package which should be handled by this logger
# level: info
# additivity: true # when set to false, root logger will not receive events already logged here
# AppenderRef:
# ref: LdapLog # name of the appender that is served by this logger
In order to enable debug logging in our sample scenario, you will need to enable the commented-out sections and set the level to debug
.
Configuration:
appenders: # The appenders define how messages are logged.
File:
# This appender (if uncommented) writes all messages to logs/ldap.log.
# This appender is referenced by name LdapLog in the logger configuration below.
- name: LdapLog
fileName: logs/ldap.log
PatternLayout:
Pattern: "* %-5level [%threadName] %date:%variablesNotEmpty{ %mdc{job}:} %message%n"
# This appender (if uncommented) writes all messages with marker "Voting" to logs/voting.log.
# This appender is referenced by name VotingLog in the logger configuration below.
Loggers: # The loggers define which messages are routed to which appenders.
# Configuration for the "LdapLog" file appender example above that also logs level info to the appender.
- name: com.teamscale.core.authenticate.ldap # name of the package which should be handled by this logger
level: debug
additivity: true # when set to false, root logger will not receive events already logged here
AppenderRef:
ref: LdapLog # name of the appender that is served by this logger
If you would like to (or were asked to) increase the log level for a different package, you may put that package's name into the name
property of the additional logger.
Of course you can also add several new loggers for different packages at the same time.