Logging
View Log Files
Backend
The backed logfiles can be directly viewed from within the vscode web interface. Located under https://portrait.yourDomain.com/config/.
Others
You can see the logs of Portrait on the server. Navigate to the installation folder of Portrait and execute the following commands:
See all logs
docker-compose logsSee the frontend logs
docker-compose logs frontendFollow the server logs
docker-compose logs -f frontendYou can close this view with CTRL+C.
See the last 500 entries of the server logs
docker-compose logs --tail 500 backend
All examples are based on the standard docker container names, if you changed them, you need to take this into account for your logs commands.
Custom Logging Configuration
Portrait uses the Logback Library for Logging and comes with a default logging configuration.
This configuration can be overwritten with your own.
Configuration in application.yml:
####################################
# Application properties #
####################################
logging:
config: config/logback.xmlThe path of the logfile needs to be accessable within the docker container. Therefore it should be in the config folder which is mapped as a volume inside the container.
Example logback.xml
<configuration>
<property name="HOME_LOG" value="logs/portrait_backend.log"/>
<appender name="FILE-ROLLING" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${HOME_LOG}</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>logs/archived/portrait_backend.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
<!-- each archived file, size max 10MB -->
<maxFileSize>10MB</maxFileSize>
<!-- total size of all archive files, if total size > 20GB, it will delete old archived file -->
<totalSizeCap>20GB</totalSizeCap>
<!-- 60 days to keep -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>%d [%thread] %-5level %logger{36}:%method - %msg%n</pattern>
</encoder>
</appender>
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<layout class="ch.qos.logback.classic.PatternLayout">
<Pattern>
%d [%thread] %highlight(%-5level) %cyan(%logger{36}):%green(%method) - %msg%n
</Pattern>
</layout>
</appender>
<logger name="at.treskon" level="WARN" additivity="false">
<appender-ref ref="FILE-ROLLING"/>
<appender-ref ref="CONSOLE"/>
</logger>
<root level="error">
<appender-ref ref="FILE-ROLLING"/>
<appender-ref ref="CONSOLE"/>
</root>
</configuration> The Logfiles should be written to logs/. Then the files will be mapped on the host via docker-compose.
Further Information is available on the official logback documentation