Skip to content

Logging

assimbly edited this page Dec 16, 2020 · 2 revisions

Logging

There are three ways to view the logging of Assimbly

  1. Command Line: When started from command line (with java -jar) you see the log in System.out.

  2. File System: The log file of Assimbly is by default created in the user.home directory:

        ${user.home}/.assimbly/%d{yyyy-MM-dd}.assimbly.log
    

(on Windows for example: C:\Users\username.assimbly\2019-01-01.assimbly.log).

  1. GUI. It's also possible to view the log within the browser:

       Administration --> Log viewer
    

By default logs are written to FILE and CONSOLE.

Change log location

There are several ways to change the log location

  1. Java Command Line parameter

Start Assimbly as follows:

       java -Duser.home=<new_location> -jar assimbly.jar 
  1. Spring boot parameter

        java -jar assimbly.jar --application.gateway.base-directory=<new_location>
    

Override application parameters

The current default parameters are listed in the application.yml and application-prod.yml

These parameters can be overridden on the command line with parameters starting with ‘--’. For examples:

       java -jar assimbly.jar --log.level.ROOT=DEBUG

       java -jar assimbly.jar --application.gateway.name=MyGateway

       java -jar assimbly.jar --datasource.url=jdbc:mysql://localhost:3306/gateway?useUnicode=true&characterEncoding=utf8&useSSL=false&useLegacyDatetimeCode=false&serverTimezone=UTC&createDatabaseIfNotExist=true --datasource.username=MyUser 

By default Assimbly will convert any command line option arguments (starting with ‘--’, e.g. --server.port=9000) to a property. Command line properties always take precedence over other property sources.

Custom log configuration

It's also possible to load a custom log configuration. For example to disable FILE or CONSOLE logging or change it parameters.

  1. Create a file logback.xml
  2. Add the default log configuration
<!DOCTYPE configuration>

<configuration scan="true">
    <include resource="org/springframework/boot/logging/logback/base.xml"/>

<!-- The FILE and ASYNC appenders are here as examples for a production configuration -->
    <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
       <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <fileNamePattern>${user.home}/.assimbly/logs/%d{yyyy-MM-dd}.assimbly.log</fileNamePattern>
            <maxHistory>90</maxHistory>
		    <totalSizeCap>20GB</totalSizeCap>
        </rollingPolicy>
        <encoder>
            <charset>utf-8</charset>
            <Pattern>%d %-5level [%thread] %logger{0}: %msg%n</Pattern>
        </encoder>
    </appender>

    <appender name="ASYNC" class="ch.qos.logback.classic.AsyncAppender">
        <queueSize>512</queueSize>
        <appender-ref ref="FILE"/>
    </appender>

    <root level="${logging.level.root}">
        <appender-ref ref="ASYNC"/>
    </root>

    <logger name="javax.activation" level="WARN"/>
    <logger name="javax.mail" level="WARN"/>
    <logger name="javax.management.remote" level="WARN"/>
    <logger name="javax.xml.bind" level="WARN"/>
    <logger name="ch.qos.logback" level="WARN"/>
    <logger name="com.codahale.metrics" level="WARN"/>
    <logger name="com.ryantenney" level="WARN"/>
    <logger name="com.sun" level="WARN"/>
    <logger name="com.zaxxer" level="WARN"/>
    <logger name="io.undertow" level="WARN"/>
    <logger name="io.undertow.websockets.jsr" level="ERROR"/>
    <logger name="org.ehcache" level="WARN"/>
    <logger name="org.apache" level="WARN"/>
    <logger name="org.apache.catalina.startup.DigesterFactory" level="OFF"/>
    <logger name="org.bson" level="WARN"/>
    <logger name="org.hibernate.validator" level="WARN"/>
    <logger name="org.hibernate" level="WARN"/>
    <logger name="org.hibernate.ejb.HibernatePersistence" level="OFF"/>
    <logger name="org.springframework" level="WARN"/>
    <logger name="org.springframework.web" level="WARN"/>
    <logger name="org.springframework.security" level="WARN"/>
    <logger name="org.springframework.cache" level="WARN"/>
    <logger name="org.thymeleaf" level="WARN"/>
    <logger name="org.xnio" level="WARN"/>
    <logger name="springfox" level="WARN"/>
    <logger name="sun.rmi" level="WARN"/>
    <logger name="liquibase" level="WARN"/>
    <logger name="org.quartz.core.QuartzSchedulerThread" level="WARN"/>    
    <logger name="LiquibaseSchemaResolver" level="INFO"/>
    <logger name="sun.rmi.transport" level="WARN"/>

    <!-- https://logback.qos.ch/manual/configuration.html#shutdownHook and https://jira.qos.ch/browse/LOGBACK-1090 -->
    <shutdownHook class="ch.qos.logback.core.hook.DelayingShutdownHook"/>

    <contextListener class="ch.qos.logback.classic.jul.LevelChangePropagator">
        <resetJUL>true</resetJUL>
    </contextListener>

</configuration>
  1. Modify the XML logfile

For example change the size cap from 20GB to 10GB:

         <totalSizeCap>10GB</totalSizeCap> 
  1. Start Assimbly with the new log file

          java -jar assimbly.jar --logging.config=file:/loglocation/logback.xml
    
Clone this wiki locally