Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
tutorial:adm:czechidm_installation_win [2018/11/09 14:18]
fiserp [Create CzechIdM configuration folders]
tutorial:adm:czechidm_installation_win [2019/10/17 13:26] (current)
urbanl Added changes in tomcat properties and logback spring for log rotation.
Line 22: Line 22:
   * Add ''​C:​\CzechIdM\etc;​C:​\CzechIdM\lib;​C:​\CzechIdM\lib\\*;''​ to the **beginning of the** ''​CLASSPATH''​. If you followed the [[tutorial:​adm:​server_preparation_win|]] guide, this should already be in place.   * Add ''​C:​\CzechIdM\etc;​C:​\CzechIdM\lib;​C:​\CzechIdM\lib\\*;''​ to the **beginning of the** ''​CLASSPATH''​. If you followed the [[tutorial:​adm:​server_preparation_win|]] guide, this should already be in place.
   * Add ''​-Dspring.profiles.active=production''​ and ''​-Djava.util.Arrays.useLegacyMergeSort=true''​to the ''​Java options''​.   * Add ''​-Dspring.profiles.active=production''​ and ''​-Djava.util.Arrays.useLegacyMergeSort=true''​to the ''​Java options''​.
 +
 +=== Change Tomat logging properties ===
 +
 +In order to set-up log rotation we need stop logging to stdout and start logging to catalina.log .
 +
 +Make these changes in file "/​c/​Program\ Files/​Apache\ Software\ Foundation/​Tomcat\ 8.5/​conf/​logging.properties"​
 +Comment out console handler. We don't want tomcat to log to stdout or stderr.
 +<​code>​
 +handlers = 1catalina.org.apache.juli.AsyncFileHandler,​ 2localhost.org.apache.juli.AsyncFileHandler,​ 3manager.org.apache.juli.AsyncFileHandler,​ 4host-manager.org.apache.juli.AsyncFileHandler
 +#handlers =  java.util.logging.ConsoleHandler
 +
 +.handlers = 1catalina.org.apache.juli.AsyncFileHandler
 +#.handlers = java.util.logging.ConsoleHandler,​
 +
 +#​java.util.logging.ConsoleHandler.level = FINE
 +#​java.util.logging.ConsoleHandler.formatter = org.apache.juli.OneLineFormatter
 +</​code>​
 +In 1catalina file handler change log level to "​INFO"​ and prefix from "​catalina"​ to "​tomcat"​. Also set property rotable to "​false"​. Tomcat write to this file only when starting or shutting down.
 +<​code>​
 +#​1catalina.org.apache.juli.AsyncFileHandler.level = FINE
 +#​1catalina.org.apache.juli.AsyncFileHandler.prefix = catalina.
 +1catalina.org.apache.juli.AsyncFileHandler.level = INFO
 +1catalina.org.apache.juli.AsyncFileHandler.directory = ${catalina.base}/​logs
 +1catalina.org.apache.juli.AsyncFileHandler.prefix = tomcat
 +1catalina.org.apache.juli.AsyncFileHandler.rotatable = false
 +1catalina.org.apache.juli.AsyncFileHandler.suffix = .log
 +</​code>​
 +
  
 ==== Create CzechIdM configuration folders ==== ==== Create CzechIdM configuration folders ====
Line 88: Line 116:
 org.quartz.jobStore.tablePrefix=qrtz_ org.quartz.jobStore.tablePrefix=qrtz_
 </​file>​ </​file>​
-  * The **C:​\CzechIdM\etc\logback-spring.xml** specifies logging configuration. This is the default logging configuration that you can use out of the box.<file xml logback-spring.xml>​+  * The **C:​\CzechIdM\etc\logback-spring.xml** specifies logging configuration. This is the default logging configuration that you can use out of the box.<code xml logback-spring.xml>​
 <?xml version="​1.0"​ encoding="​UTF-8"?>​ <?xml version="​1.0"​ encoding="​UTF-8"?>​
 <!-- https://​springframework.guru/​using-logback-spring-boot/​ --> <!-- https://​springframework.guru/​using-logback-spring-boot/​ -->
 <!-- http://​logback.qos.ch/​manual/​appenders.html --> <!-- http://​logback.qos.ch/​manual/​appenders.html -->
 <​configuration>​ <​configuration>​
-    <include resource="​org/​springframework/​boot/​logging/​logback/​base.xml"/>​ +        ​<​springProperty name="​spring.profiles.active"​ source="​spring.profiles.active"/>​ 
-    ​<​springProperty name="​spring.profiles.active"​ source="​spring.profiles.active"/​+        <include resource="org/​springframework/​boot/​logging/​logback/​file-appender.xml"/>​ 
-    <​springProfile name="​default"​+        <include resource="​org/​springframework/​boot/​logging/​logback/​defaults.xml"/>​ 
-        <logger name="eu.bcvsolutions"​ level="​INFO"/>​ +        <​springProfile name="production">​ 
-        <logger name="org.springframework"​ level="​INFO"​/+                <logger name="​eu.bcvsolutions"​ level="​INFO"/>​ 
-        <logger name="​org.springframework.web" level="​INFO"​/+                <logger name="​org.springframework"​ level="​INFO"/>​ 
-        <logger name="​org.hibernate.SQL"​ level="​INFO"/>​ +                <logger name="​org.springframework.web"​ level="​INFO"/>​ 
-        ​<logger name="​org.hibernate.type.descriptor.sql.BasicBinder"​ level="​INFO"/>​ +                <logger name="​org.hibernate.SQL"​ level="​INFO"/>​ 
-    </​springProfile>​ +                <logger name="​org.hibernate.type.descriptor.sql.BasicBinder"​ level="​INFO"/>​ 
- +                <​appender name="idm" class="​ch.qos.logback.core.rolling.RollingFileAppender">​ 
-    ​<​springProfile name="test">​ +                        <encoder
-        <logger name="​eu.bcvsolutions"​ level="​DEBUG"/>​ +                                <pattern> 
-        <logger name="​org.springframework"​ level="​INFO"/>​ +                                         %d{yyyy-MM-dd HH:mm:ss.SSS} %5level %relative ​--- [%thread] %logger{36}.%M : %msg%n 
-        <logger name="​org.springframework.web"​ level="​INFO"/>​ +                                ​</pattern
-        <logger name="​org.hibernate.SQL"​ level="​INFO"/>​ +                        </encoder
-        <logger name="​org.hibernate.type.descriptor.sql.BasicBinder"​ level="​INFO"/>​ +                        <file>logs/catalina.log</file
-    </​springProfile>​ +                        <rollingPolicy ​class="​ch.qos.logback.core.rolling.TimeBasedRollingPolicy">​ 
- +                                <fileNamePattern>logs/catalina.%d{yyyy-MM-dd}.log</fileNamePattern
-    <​springProfile name="​dev"> ​  +                                <maxHistory>90</maxHistory
-        <​springProperty name="​spring.datasource.driver-class-name"​ source="​spring.datasource.driver-class-name"/>​ +                        </rollingPolicy
-        <​springProperty name="​spring.datasource.url"​ source="​spring.datasource.url"/>​ +                </appender    ​ 
-        <​springProperty name="​spring.datasource.username"​ source="​spring.datasource.username"/>​ +                <root level="​INFO">​ 
-        <​springProperty name="​spring.datasource.password"​ source="​spring.datasource.password"/>​ +                        <appender-ref ref="idm"/>​ 
- +                </root
-        ​<​appender name="DB" class="​ch.qos.logback.classic.db.DBAppender">​ +        </​springProfile>​
-            <connectionSource class="​ch.qos.logback.core.db.DriverManagerConnectionSource"​+
-                <driverClass>${spring.datasource.driver-class-name}</driverClass+
-                <​url>​${spring.datasource.url}</url+
-                <user>${spring.datasource.username}<​/user> +
-                <​password>​${spring.datasource.password}</password+
-            </​connectionSource>​ +
-        </​appender>​ +
- +
-        <​appender name="​DB_ASYNC" ​class="​ch.qos.logback.classic.AsyncAppender">​ +
-            <appender-ref ref="​DB"​ /> +
-            <​includeCallerData>​true<​/includeCallerData>​ +
-        </​appender>​ +
- +
-        <logger name="​eu.bcvsolutions"​ level="​TRACE">​ +
-            <​appender-ref ref="​DB_ASYNC"​ /> +
-        </​logger>​ +
-        <logger name="​org.springframework"​ level="​INFO"/>​ +
-        ​<logger name="​org.springframework.web"​ level="​DEBUG"​/> +
-        <logger name="​org.hibernate.SQL"​ level="​DEBUG"/​> +
-        ​<logger name="​org.hibernate.type.descriptor.sql.BasicBinder"​ level="​TRACE"​/> +
-    </springProfile+
- +
-    ​<springProfile name="​dev-mysql"> ​    +
-        <logger name="​eu.bcvsolutions"​ level="​TRACE" ​/> +
-        <logger name="​org.springframework" ​level="​INFO"​/+
-        <logger name="​org.springframework.web"​ level="DEBUG"/>​ +
-        <logger name="​org.hibernate.SQL"​ level="​DEBUG"​/> +
-        ​<logger name="​org.hibernate.type.descriptor.sql.BasicBinder"​ level="​TRACE"/> ​        +
-    ​</​springProfile>​+
 </​configuration>​ </​configuration>​
-</file>+</code>
   * The most important file is **C:​\CzechIdM\etc\application-production.properties** (application-PROFILE.properties,​ where the PROFILE is the profile you run the IdM under). You can use most of the file as-is, there is a bit of configuration needed though. This is a template file:<​file properties application-production.properties>​   * The most important file is **C:​\CzechIdM\etc\application-production.properties** (application-PROFILE.properties,​ where the PROFILE is the profile you run the IdM under). You can use most of the file as-is, there is a bit of configuration needed though. This is a template file:<​file properties application-production.properties>​
 # Doc: https://​wiki.czechidm.com/​devel/​dev/​configuration/​backend # Doc: https://​wiki.czechidm.com/​devel/​dev/​configuration/​backend