If you want to log information about user actions in Web Application Platform, Teamwork Cloud responses, and other technical data like Web Application Platform errors, you have to configure logging as described below.
To configure logging
Copy and paste the following text to the logback.xml file:
<?xml version="1.0" encoding="UTF-8"?> <configuration> <contextName>webapp</contextName> <jmxConfigurator/> <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> <Pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n</Pattern> </encoder> </appender> <appender name="WEBAPPPLATORM_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> <append>true</append> <file><tomcat_home>\logs\webappplatform\webappplatform.log</file> <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> <!-- rollover daily --> <fileNamePattern>webappplatform.%d{yyyy-MM-dd}.%i.log</fileNamePattern> <!-- each file should be at most 100MB, keep 60 days worth of history, but at most 20GB --> <maxFileSize>20MB</maxFileSize> <maxHistory>60</maxHistory> <totalSizeCap>1GB</totalSizeCap> </rollingPolicy> <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> <pattern>%date [%thread] %-5level %logger - %msg%n</pattern> </encoder> </appender> <appender name="TWC_RESPONSE_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> <append>true</append> <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> <pattern>%date [%thread] %-5level %logger - %msg%n</pattern> </encoder> <file><tomcat_home>\logs\webappplatform\twc_response.log</file> <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> <file><tomcat_home>\logs\webappplatform\twc_response.log</file> <!-- rollover daily --> <fileNamePattern>twc_response.%d{yyyy-MM-dd}.%i.log</fileNamePattern> <!-- each file should be at most 100MB, keep 60 days worth of history, but at most 20GB --> <maxFileSize>20MB</maxFileSize> <maxHistory>60</maxHistory> <totalSizeCap>1GB</totalSizeCap> </rollingPolicy> </appender> <logger name="TWC_RESPONSE_LOGGER" level="debug"> <appender-ref ref="TWC_RESPONSE_FILE" /> </logger> <logger name="com.nomagic.webappplatform" level="debug"> <appender-ref ref="WEBAPPPLATORM_FILE" /> </logger> <logger name="com.nomagic.webappplatform.collaborator.licensing.LicensingService" level="debug"> <appender-ref ref="STDOUT" /> </logger> </configuration> |
The logback.xml file describes three appenders between the <appender> tags. The STDOUT appender is used when logging data to the console. The WEBAPPPLATORM_FILE and TWC_RESPONSE_FILE appenders are used when logging data to the webappplatform.log and twc_response.log files. |
all - designates events of all the levels including custom levels.
debug - designates fine-grained informational events that are most useful to debug an application.
error - designates error events that might still allow the application to continue running.
fatal - designates very severe error events that will presumably lead the application to abort.
info - designates informational messages that highlight the progress of the application at coarse-grained level.
trace - designates finer-grained informational events than "debug".
warn - designates potentially harmful situations.
off - turns logging of.
The logback.xml file has three loggers. The TWC_RESPONSE_LOGGER logs data to the twc_response.log file, the "com.nomagic.webappplatform" logger logs data the webappplatform.log file, and the "com.nomagic.webappplatform.collaborator.licensing.LicensingService" logger logs data to the console. You can change any of the levels listed above for each logger. By default, all logging levels are "debug". |
You can disable data logging to a specific file by changing the logging level of the related logger.
To turn off logging
Change the logging level of that logger to "off".
To turn on the data logging that has been disabled, change the logging level of the related logger from "off" to the logging level you want to use. Available logging levels are described in step 5 of the above section. |