If you want to log information about user actions in Web Application Platform, Magic Collaboration Studio responses, and other technical data like Web Application Platform errors, you have to configure logging as described below.
To configure logging
- In the Java application server (on which Web Application Platform runs) home directory, go to the shared > conf folder. For example, if you use Apache Tomcat, go to <tomcat_home>\shared\conf.
- Using a plain text editor create the logback.xml file in that directory.
Copy and paste the following text to the logback.xml file:
<?xml version="1.0" encoding="UTF-8"?> <configuration debug="false"> <contextName>webapp</contextName> <property name="WEBAPP_LOG_BASE" value="${catalina.base}" /> <appender name="CONSOLE" 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="WEB-APP-FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> <append>true</append> <file>${WEBAPP_LOG_BASE}/logs/webappplatform/web-app.log</file> <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"> <fileNamePattern>${WEBAPP_LOG_BASE}/logs/webappplatform/web-app.%i.log.zip</fileNamePattern> <minIndex>1</minIndex> <maxIndex>10</maxIndex> </rollingPolicy> <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> <maxFileSize>100MB</maxFileSize> </triggeringPolicy> <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> <file>${WEBAPP_LOG_BASE}/logs/webappplatform/twc_rest.log</file> <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"> <fileNamePattern>${WEBAPP_LOG_BASE}/logs/webappplatform/twc_rest.%d{yyyy-MM-dd}.%i.log</fileNamePattern> <minIndex>1</minIndex> <maxIndex>10</maxIndex> </rollingPolicy> <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> <maxFileSize>100MB</maxFileSize> </triggeringPolicy> <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> <pattern>%date [%thread] %-5level %logger - %msg%n</pattern> </encoder> </appender> <appender name="ADMIN-CONSOLE-FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> <file>${WEBAPP_LOG_BASE}/logs/webappplatform/admin-console.log</file> <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"> <fileNamePattern>${WEBAPP_LOG_BASE}/logs/webappplatform/admin-console.%i.log.zip</fileNamePattern> <minIndex>1</minIndex> <maxIndex>10</maxIndex> </rollingPolicy> <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> <maxFileSize>100MB</maxFileSize> </triggeringPolicy> <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> <pattern>%date [%thread] %-5level %logger - %msg%n</pattern> </encoder> </appender> <appender name="COLLABORATOR-FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> <append>true</append> <file>${WEBAPP_LOG_BASE}/logs/webappplatform/collaborator.log</file> <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"> <fileNamePattern>${WEBAPP_LOG_BASE}/logs/webappplatform/collaborator.%i.log.zip</fileNamePattern> <minIndex>1</minIndex> <maxIndex>10</maxIndex> </rollingPolicy> <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> <maxFileSize>100MB</maxFileSize> </triggeringPolicy> <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> <pattern>%date [%thread] %-5level %logger - %msg%n</pattern> </encoder> </appender> <appender name="DOCUMENT-EXPORTER-FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> <file>${WEBAPP_LOG_BASE}/logs/webappplatform/document-exporter.log</file> <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"> <fileNamePattern>${WEBAPP_LOG_BASE}/logs/webappplatform/document-exporter.%i.log.zip</fileNamePattern> <minIndex>1</minIndex> <maxIndex>10</maxIndex> </rollingPolicy> <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> <maxFileSize>100MB</maxFileSize> </triggeringPolicy> <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> <pattern>%date [%thread] %-5level %logger - %msg%n</pattern> </encoder> </appender> <appender name="RESOURCES-FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> <append>true</append> <file>${WEBAPP_LOG_BASE}/logs/webappplatform/resources.log</file> <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"> <fileNamePattern>${WEBAPP_LOG_BASE}/logs/webappplatform/resources.%i.log.zip</fileNamePattern> <minIndex>1</minIndex> <maxIndex>10</maxIndex> </rollingPolicy> <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> <maxFileSize>100MB</maxFileSize> </triggeringPolicy> <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> <pattern>%date [%thread] %-5level %logger - %msg%n</pattern> </encoder> </appender> <appender name="RESOURCE-USAGE-MAP-FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> <file>${WEBAPP_LOG_BASE}/logs/webappplatform/resource-usage-map.log</file> <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"> <fileNamePattern>${WEBAPP_LOG_BASE}/logs/webappplatform/resource-usage-map.%i.log.zip</fileNamePattern> <minIndex>1</minIndex> <maxIndex>10</maxIndex> </rollingPolicy> <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> <maxFileSize>100MB</maxFileSize> </triggeringPolicy> <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> <pattern>%date [%thread] %-5level %logger - %msg%n</pattern> </encoder> </appender> <appender name="REPORTS-FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> <file>${WEBAPP_LOG_BASE}/logs/webappplatform/reports.log</file> <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"> <fileNamePattern>${WEBAPP_LOG_BASE}/logs/webappplatform/reports.%i.log.zip</fileNamePattern> <minIndex>1</minIndex> <maxIndex>10</maxIndex> </rollingPolicy> <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> <maxFileSize>100MB</maxFileSize> </triggeringPolicy> <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> <pattern>%date [%thread] %-5level %logger - %msg%n</pattern> </encoder> </appender> <appender name="SIMULATION-FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> <append>true</append> <file>${WEBAPP_LOG_BASE}/logs/webappplatform/simulation.log</file> <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"> <fileNamePattern>${WEBAPP_LOG_BASE}/logs/webappplatform/simulation.%i.log.zip</fileNamePattern> <minIndex>1</minIndex> <maxIndex>10</maxIndex> </rollingPolicy> <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> <maxFileSize>100MB</maxFileSize> </triggeringPolicy> <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> <pattern>%date [%thread] %-5level %logger - %msg%n</pattern> </encoder> </appender> <appender name="AUTHENTICATION-FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> <file>${WEBAPP_LOG_BASE}/logs/webappplatform/authentication.log</file> <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"> <fileNamePattern>${WEBAPP_LOG_BASE}/logs/webappplatform/authentication.%i.log.zip</fileNamePattern> <minIndex>1</minIndex> <maxIndex>10</maxIndex> </rollingPolicy> <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> <maxFileSize>100MB</maxFileSize> </triggeringPolicy> <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> <pattern>%date [%thread] %-5level %logger - %msg%n</pattern> </encoder> </appender> <root level="WARN"> <appender-ref ref="CONSOLE"/> </root> <logger name="com.nomagic.webappplatform" level="INFO" additivity="false"> <appender-ref ref="WEB-APP-FILE"/> </logger> <logger name="com.nomagic.authentication" level="INFO" additivity="false"> <appender-ref ref="WEB-APP-FILE"/> </logger> <logger name="com.nomagic.webappplatform.adminconsole" level="INFO" additivity="false"> <appender-ref ref="ADMIN-CONSOLE-FILE"/> </logger> <logger name="com.nomagic.webappplatform.resourcemanager" level="INFO" additivity="false"> <appender-ref ref="RESOURCES-FILE"/> </logger> <logger name="com.nomagic.webappplatform.collaborator" level="INFO" additivity="false"> <appender-ref ref="COLLABORATOR-FILE"/> </logger> <logger name="com.nomagic.webappplatform.export" level="INFO" additivity="false"> <appender-ref ref="DOCUMENT-EXPORTER-FILE"/> </logger> <logger name="com.nomagic.webappplatform.resourceusagemap" level="INFO" additivity="false"> <appender-ref ref="RESOURCE-USAGE-MAP-FILE"/> </logger> <logger name="com.nomagic.webappplatform.reports" level="INFO" additivity="false"> <appender-ref ref="REPORTS-FILE"/> </logger> <logger name="com.nomagic.webappplatform.simulation" level="INFO" additivity="false"> <appender-ref ref="SIMULATION-FILE"/> </logger> <logger name="com.nomagic.authentication.server" level="INFO" additivity="false"> <appender-ref ref="AUTHENTICATION-FILE"/> </logger> <logger name="org.springframework" level="OFF"> <appender-ref ref="WEB-APP-FILE"/> </logger> <logger name="TWC_REST_LOGGER" level="OFF"> <appender-ref ref="TWC_RESPONSE_FILE" /> </logger> </configuration>
Described appenders
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.
- Specify the following properties for the WEBAPPPLATORM_FILE and TWC_RESPONSE_FILE appenders:
- Full paths to the log files (between the <file> tags). To specify a path, replace the <tomcat_home> placeholder in the path with the home directory of the Java application server that Web Application Platform runs on.
- File name patterns of the log files (between the <fileNamePattern> tags). You can leave the default file name pattern values.
- Maximum log file sizes (between the <maxFileSize> tags. You can leave the default maximum file size values.
- Maximum history in days (between the <maxHistory> tags). You can leave the default maximum history values.
- Total size capacity (between the <totalSizeCap> tags). You can leave the default total size capacity values.
- Specify one of the following logging levels for the TWC_RESPONSE_LOGGER and "com.nomagic.webappplatform" loggers or leave the default value "debug":
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.
Specifying logging levels
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".
- Save and close the logback.xml file.
- Restart the Java application server.
How to turn off logging
You can disable data logging to a specific file by changing the logging level of the related logger.
To turn off logging
- Locate the logger the logging of which you want to turn off.
Change the logging level of that logger to "off".
- Restart the Java application server.
Turning logging back on
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.